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

Report as inappropriate.

AndrewCZ
AndrewCZ presents ...

2015/10/23

Snake remake

No description.

2166 views / 5 in the last 7 days

Tags: with-source snake

open in greenfoot
Your browser does not support the canvas tag.
A new version of this scenario was uploaded on 2015-10-23 17:57:00 UTC
A new version of this scenario was uploaded on 2015-10-23 18:10:02 UTC
A new version of this scenario was uploaded on 2015-10-23 18:24:01 UTC Forgot to tick "Publish source code"...
cwars024cwars024

2020/1/17

Can you explain what this does: counter--; if (counter == 0){ getWorld().removeObject(this); } I understand what the other things do I just don't understand this.
danpostdanpost

2020/1/17

@cwars024, the constructor of the class has counter set to the number of parts to the snake and each body part will be removed after it becomes the tail end (which is when the counter reaches zero for that body part).

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.