This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Game Development and the fly likes Building new game, Java 2D question about objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Building new game, Java 2D question about objects "diappearing"" Watch "Building new game, Java 2D question about objects "diappearing"" New topic
Author

Building new game, Java 2D question about objects "diappearing"

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

What is the most efficient way to have 2D objects "disappear"?
Here is an example:
If block1 is hit, block1hitmarker = true.
Later in code:

Or is there a better way to do this?
Thanks,
cc11rocks


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3893
    
  18

Simply don't draw them. What you are doing seems correct, except for some minor issues I have addressed in your other topic.


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Building new game, Java 2D question about objects "diappearing"
 
It's not a secret anymore!