This site requires JavaScript, please enable it in your browser!
Greenfoot back
GreenFootieNewbie
GreenFootieNewbie wrote ...

2014/6/6

Need more help.

GreenFootieNewbie GreenFootieNewbie

2014/6/6

#
Can someone tell me the code so that if my current class touches the side of the world, it will remove the class? I have the spawner spawn non-killer sprites to add some detail to the game, but obviously with the Random Number Generator going it will be constantly going, and my game will eventually start lagging. I just need to know the code that will remove the Sprites class when they touch any of the edges of the world, thank you so much for any help :D. Also, if anyone knows any Youtube videos or links in the Greenfoot website, that has the code and or can teach you how to have your person and any enemies have life points? Thanks.
danpost danpost

2014/6/6

#
Import the Animal class via the menubar 'Edit>Import class...' and look at the 'atWorldEdge' method and the 'eat' method. They should lead you to what you are looking for (you can use the 'this' keyword to refer to the object to be removed).
You need to login to post a reply.