How to make player "jump"
by Arthur Yanthar · in Torque X 2D · 11/02/2009 (1:28 pm) · 3 replies
I have pretty much looked everywhere on the internet on how to do this and either I could not find anything, or any advice given resulted in an error. I have even attempted this myself, but with my lack of experience of C#, I was not able to do this. I was wondering if anyone knows how to make a player "jump". Also, I want it to be either as detailed as possible with every single step shown in detail, or perhaps a link to the internet that will either be a torque x 2d project file that contains a jump component or perhaps just the jump component file. Thanks in advanced!
#2
11/02/2009 (6:43 pm)
The game is going to be a generic side-view platformer. There are going to be a few puzzle elements in the game, but I don't think they are important to figure out how to make the player jump.
#3
http://www.garagegames.com/products/tx-2d-platformer-kit
11/02/2009 (10:03 pm)
The platformer starter kit includes an actor component with the ability to jump. I've found it to be well worth the price.http://www.garagegames.com/products/tx-2d-platformer-kit
Torque Owner William McDonald
Suckerfree Games
If you are using a side-view platformer, you will need a "gravity" component. Each tick, it should add to your downward velocity to make you fall. Then, when you jump, you just set a large upwards velocity. Eventually, the cumulative effects of the gravity component will cause them to fall.
A top-down game would probably just need a graphic change to simulate a jump. In code, you would just need to check to see if a player is over a pit and isn't jumping.
A game with a fake depth of field is very tough. The way I did it is to create the player and his shadow. I mount the player to his shadow. All the player control logic is set to the shadow instead of the character sprite. When the character jumps, I alter the offset between the shadow and the player to simulate a jump.
I'm sure if you post the way your game works you could get a more detailed response.