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

2015/10/4

Help with variable

Elexios Elexios

2015/10/4

#
long story i have a variable called "DoOnce" that makes a chest only open once. But thats not the point, the point is on every call of act the variable is checked. However i need it to be declared once and then not changed by the declaration of itself again. So in other words i have an actor with Int DoOnce = 0 ; In it and then other things can change DoOnce but then when act is called again it returns to value of 0. Any way to easily stop this or declaring a variable and leaving it empty? Thanks. :)
danpost danpost

2015/10/4

#
You are probably declaring the variable within a method or constructor. Declare it outside any method or constructor to have the actor retain its value.
You need to login to post a reply.