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

2016/2/15

Both World and Actor have act() methods. How affected by Run command?

keizerbob keizerbob

2016/2/15

#
Starting to write my first scenario, I notice both World-derived and Actor-derived classes have distinct act() methods. If one designed a scenario in which both myWorld and myActor had act() methods, how would the Run command work? My guess is that both methods would trigger in each run cycle. So maybe a scenario design guideline is that "myWorld" does a one-time setup operation and all the Actor-derived classes do the dynamic stuff (or vice versa, but not both).
danpost danpost

2016/2/16

#
In every running frame (act cycle) the act method of the active world and the act method of all actors currently in that world will execute. The act method of the Actor objects in the world control the individual behavior of those actors and the act method of the active World object controls the behavior of that world (usually to control general game play, the background image and music, and world changing/stopping operations).
keizerbob keizerbob

2016/2/16

#
danpost:Thanks for the explanation. It helps me assign supervisory and action roles in the World and Actors in my scenario.
You need to login to post a reply.