Game Development Community

Jump Command Help

by Alexander \"Xander\" Brown · in Torque Game Builder · 11/06/2008 (2:58 am) · 1 replies

Okay i've been trying to figuer out a good way to do this. I need my 'player' to jump up and down like in a platform but from a faked perspective view ware you have 4 way movement (simmiler to the old 2d hack and slash games). I though i could use a path, like have it draw a two piont path and just bounce the sprite from one to the other and back again, but i can't figuer out how to temp make the path in script or mount the sprite to it? any help would be vary helpfull.

#1
11/11/2008 (10:07 pm)
This is what im using right now. it works to about 50% of what i want. but it still needs to reSort it self in the layer. can you call that in the script and how?

.........
moveMap.bindCmd(keyboard, "space", "jumpup();", "jumpdown();");
.........
.........
function jumpUp(){
   $player.jump("0 -10");}
function jumpDown(){
   $player.jump("0 10");}
function playerclass::jump(%this, %amount){
               %position = %this.getPosition();
               %newPosition = t2dVectorAdd(%position, %amount);
               %this.setPosition(%newPosition);
               return %newPosition;}