Game Development Community

Obj.setVelocity() question

by Adam · in Torque Game Engine · 09/15/2006 (2:16 pm) · 5 replies

My goal is to add an item to my level that when picked up it doubles the players speed. Is the player an object of ShapeBase so I can use obj.setVelocity(obj.getVelocity()*2))? Then I am thinking about creating a function that is called in like 7 seconds that sets everything back to normal.

If I can't do this with the player what other options do I have because once a datablock value is set, it is permanent right and can't be changed during runtime? So I would also need to be able to modify the players maxspeed temporarily. I've done something similar with physical zones, but never with an item. What would be the easiest method to do a velocity mod when a user picks up an item?

Thanks in advance.

#1
09/15/2006 (3:21 pm)
You cant do that, that's not how it works.

I suggest adding a boolean that doubles the speed in updateMove().
#2
09/15/2006 (4:55 pm)
Wow that is an excellent tip, I never thought about that thanks a lot.
#3
09/16/2006 (2:54 pm)
While, I'm on this topic, would it be possible to create two Player datablocks and then just switch them when the velocity mod is enabled so the appropriate speeds would already be set. I am thinking that I could then schedule a function to run that would set the datablocks back to normal. What do you think?
#4
09/16/2006 (2:58 pm)
While, I'm on this topic, would it be possible to create two Player datablocks and then just switch them when the velocity mod is enabled so the appropriate speeds would already be set. I am thinking that I could then schedule a function to run that would set the datablocks back to normal. What do you think?
#5
09/16/2006 (3:28 pm)
Not a good idea. That means:

1. Less datablocks spare, you only have 1024 to spend.
2. More overhead
3. Hacky

Edit: Whatever works for you, you can change it later if its not optimal. You have to start somewhere.