Actor's self.time: resettable to zero?
mhedges
Raised on VCSMember Posts: 634
Hello -
Looking at ways to enhance timer functions within an app in progress, while looking at "Timers are for chumps", trying out some demos, and trying out stuff on my own, I came to wonder the following: Is an actor's self.time resettable to zero? Why or why not, and if possible, why did I mess it up (see below)?
I inserted the old "change attribute" behavior into an actor to reset the value to zero, but it doesn't do it. I have to respawn the actor, then destroy the old one.
Thanks, regards.
Comments
The built-in Time attributes such as self.Time cannot be changed. Instead, use a custom timer. One way to do this is with an Every 0.1 seconds timer set to change a real attribute self.customTime to self.customTime + 0.1. You can then change the value to zero when needed.
Another way is by using a time stamp. Change Attribute self.timeStamp (real) to self.Time. You can calculate the elapsed time with self.timeStamp - self.Time and you can reset it by changing self.timeStamp to self.Time again.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User