PDA

View Full Version : State?


general
06-21-2006, 03:26 PM
I found something called State under the properties tab of tombstone(Spooky). What is it? How can I use it? And where can I learn more about this? I can't seem to find it in the Learning to Program with Alice textbook.

lanceA
06-21-2006, 08:29 PM
Whoever created the model for that object (tombstone) included a variable of type number and called it 'State'. Basically it stores any integer and can be used for anything you might need, i.e., maybe your world starts off with the tombstone invisible and you have set State == 1. Later on in your program you could check the value of tombstone.State and if it equaled 1 then you could make the tombstone visible (and set State to a value of not 1). In essence you're changing the 'state' of an object.

I only used the invisible/visible scenario as an example of what you could do with the State property. You could just as easily check the state of the opacity field in my example.

Treat it as a 'free' variable for the tombstone object.