Object property
by Kevin James · in Torque Game Builder · 04/01/2005 (9:12 pm) · 3 replies
Playing around with the basic tutorial, I have a function called InitProperties. In there I create (i think) a simple integer property like this:
$Player.Health=100;
However that value does not persist. When I look at it in another function, the value is always nil. What's funny is that when I decrement it, that value does persist but it looses the starting value of 100. I know, I could make a global called $health, but it would be nice to have object oriented style properties.
$Player.Health=100;
However that value does not persist. When I look at it in another function, the value is always nil. What's funny is that when I decrement it, that value does persist but it looses the starting value of 100. I know, I could make a global called $health, but it would be nice to have object oriented style properties.
About the author
Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/
#2
Thanks Melv!
04/02/2005 (7:48 am)
Doh! I was setting the value before $player was created. Stupid me.Thanks Melv!
Associate Melv May
Because you don't need to declare these are dynamic variables (fields), if you were to just decrement it without declaring it, it would then hold a new valid value.
Maybe you have a typo in there, they can be devils to find sometimes?
I'm not sure what else to suggest without seeing the relevant pieces of code really.
- Melv.