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

2016/1/28

Basic Knowledge

TomazVDSN TomazVDSN

2016/1/28

#
Friends, Is the Act method the same as the main method in other IDEs?
1
2
public void act() {
}
1
2
public static void main(String[] args){
}
danpost danpost

2016/1/28

#
TomazVDSN wrote...
Is the Act method the same as the main method in other IDEs?
No. The main method is the initial code executed in a program and would need to be called even before your initial World object is constructed. The act method cannot be called until after your initial World object is created.
TomazVDSN TomazVDSN

2016/1/28

#
danpost, thanks. I understand that Greenfoot make things much easier for game development. So what is the act method compared with the standard Java code? Thanks, Tomaz
danpost danpost

2016/1/29

#
TomazVDSN wrote...
I understand that Greenfoot make things much easier for game development. So what is the act method compared with the standard Java code?
All codes within your class editors (as well as the classes provided by greenfoot (Actor, World, GreenfootImage, etc.) as well as the internal classes greenfoot uses are Java code -- act method and all.
TomazVDSN TomazVDSN

2016/1/30

#
danpost, Thanks. Of course, I know it is based on standard Java. However I have been looking into other Java games and they use a different strategy, meaning they don't have the same ready to use Greenfoot's classes and methods. Anyway I find it different to develop a game in Greenfoot and write the same in Eclipse. Regards, Tomaz
danpost danpost

2016/1/30

#
TomazVDSN wrote...
I find it different to develop a game in Greenfoot and write the same in Eclipse.
Yes -- it is quite different. Greenfoot takes care of a lot of the nitty gritty stuff for you, so you can concentrate on creating the game play itself. It provides the World class the creates the canvas that can have actors in it; it provides the Greenfoot class for a lot of the user interaction and general purpose control; it provides the GreenfootImage class to make working with images easier; etc. The one big thing it provides is the act methods of the World and Actor classes and the controlling of objects through them (to allow the simulation to run).
You need to login to post a reply.