Creating an elevator with static sprite [Solved]
by Max Kielland · in Torque Game Builder · 10/07/2009 (8:40 pm) · 4 replies
Hello guys,
My evaluation time is soon finished and I'm trying to create an "elevator" comming upp under the player and lift him up to the final destination. The elevator is a Static Sprite located below the player with Send collision and physics enabled.
The player have a constant Y force of 140 and gravity enabled. All collision options are set true (Send, receive collision and physics)
To move the "elevator" I set it's ConstantForceY to -200 to overcome the players down force.
But the "Elevator" only rises up to the players feet and stops. If I jump with the player it goes up as long the player moves up. When the player falls down again, the "elevator" slowly goes down too under the players "weight".
How can I make the "Elevator" go from point A to B with a fixed speed and push the player up without being pushed down all the time?
Thank you.
[Edit]I have also tried moveTo() with onPositionTarget() callback to make it Immobile, but it doesn't work either.
My evaluation time is soon finished and I'm trying to create an "elevator" comming upp under the player and lift him up to the final destination. The elevator is a Static Sprite located below the player with Send collision and physics enabled.
The player have a constant Y force of 140 and gravity enabled. All collision options are set true (Send, receive collision and physics)
To move the "elevator" I set it's ConstantForceY to -200 to overcome the players down force.
But the "Elevator" only rises up to the players feet and stops. If I jump with the player it goes up as long the player moves up. When the player falls down again, the "elevator" slowly goes down too under the players "weight".
How can I make the "Elevator" go from point A to B with a fixed speed and push the player up without being pushed down all the time?
Thank you.
[Edit]I have also tried moveTo() with onPositionTarget() callback to make it Immobile, but it doesn't work either.
About the author
Owner of MK Development www.mkdevelopment.se
#3
Is there no way to do this by utilize the physic system?
(I guess your suggestion will have to be the backup plan)
10/08/2009 (8:48 am)
I just had a quick look at the source. Yes, I guess this is a cheap way to do it. But you will run into problems like what if the player decides to jump up and down on the elevator or jump off the Elevator.Is there no way to do this by utilize the physic system?
(I guess your suggestion will have to be the backup plan)
#4
I had forgot to enable a collision layer, I didn't even have to use the physics as I thought...
10/08/2009 (6:33 pm)
Okay, Managed find out how this works the "real" way ;)I had forgot to enable a collision layer, I didn't even have to use the physics as I thought...
Torque Owner RollerJesus
Dream. Build. Repeat.
Link.
Let me know if you need some further explanation.