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

2017/4/23

I NEED IMMEDIATE HELP

8
9
10
11
danpost danpost

2017/5/6

#
Xmin_Terminator wrote...
This is how I think it works but I still can't understand the full thing < Code Omitted >
The last few lines: * creates an image of extended length (horizonally or vertically) * repeatedly draws the wall image on the extended image * sets the extended image to the actor
Also this code I can' really put into words for annotating < Code Omitted >
The field is to hold the laser object that this button controls. The laser is passed into the constructor (line 2) and saved in the field (line 4). The act method says that if the laser controlled by this button is still in the world and the player touches this button, remove that laser.
Xmin_Terminator Xmin_Terminator

2017/5/7

#
What is the reasoning for the code Actor actor = new Actor(); Where Actor is the name of your object Why can't you just have addObject as the only code nessesary
danpost danpost

2017/5/7

#
Xmin_Terminator wrote...
What is the reasoning for the code Actor actor = new Actor(); Where Actor is the name of your object Why can't you just have addObject as the only code nessesary
Either way is really okay. However, if you just use addObject and find out later that you need a reference to the object (to call a method on it or to pass it to some other object or in a method call), then you will have to re-write it using the long way. I prefer to use the short way unless absolutely necessary -- but that is just personal preference.
You need to login to post a reply.
8
9
10
11