Hello Greenfoot Wizards,
I need some help displaying a variable in the world.
I know that I need to do it with an actor, and I know how to do that with static text,
But I don't know how to do it when it's a variable.
The variable is "Timer", which is in the World class ("Haven").
I created a class named "Tijd"
If it's easier to display a variable that is in the same class,
than that would be fine too.
so I also created a variable named Timer2 which holds the same value.
My question is, how can I display a variable (that of course keep showing the correct value in"Timer or Timer2") ?
I plan to use the class "Tijd" just for that.
Any help is highly appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 | int smalltimer = 0 ; /** * Act - do whatever the Tijd wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { int timer2 = ((Haven)getWorld()).timer; } |