Game Development Community

Problem with the Mini Platformer Tutorial

by Ryan Jones · in Torque Game Builder · 06/05/2007 (7:32 pm) · 4 replies

Using the Mini Platformer Tutorial as a basis I created the example used in the normal Mini Platformer Tutorial as well as the Advanced Platformer Tutorial.

The Advanced Platformer Tutorial when playing the game my movement/jump is perfect, but I really don't understand the coding so I can't figure out how to add animations along with the movements.

The normal Mini Platformer Tutorial I understand the coding, but can't get the movement/jump to work. Here is what my code looks like for player.cs

http://lightsier.googlepages.com/home

The ninja will not move left or right, but can jump once at normal height. After that he can't jump anymore. If you've noticed I tried adding the line $pGuy.updatemovement() after the movement which "works" but not fully. The ninja can move left and right, also jump as much as I want to, but his jumps are super high and if I continue to hold left or right when walking off a ledge he stays in mid air. Once I stop movement he drops to the ground.

The selections within Torque itself is fine according to the tutorial, so I believe something with my scripting.

Any help would be great.

#1
06/06/2007 (9:36 am)
Feel free to zip up your scripts and e-mail them to me at mattl@garagegames.com and I'll try and take a look if I get some time :)
#2
06/06/2007 (10:18 am)
I tested out your .cs and I would check a couple things...

first, make sure your scenegraph class is PlatformerSceneGraph, or just change this function to T2DSceneGraph.
function PlatformerSceneGraph::onUpdateScene()
{
if (isObject($pGuy))
$pGuy.updateMovement();
}

You're right, the $pGuy.updateMovement() functions can be added to the movement functions but also in the jump function.

The reason why he's jumping so high is this line:
$pGuy.setLinearVelocityY(-225);
Set the number lower and he won't jump so high :)

Anyway, that's what I did to get this to work, let me know if this works for you.
#3
06/06/2007 (3:30 pm)
Hey Melissa, thanks! That worked! I just changed the function PlaterformSceneGraph to T2DSceneGraph and now he's moving fine.

Now I just can't decide which tutorial has the better movement, the basic or the advanced. Oh well, I guess as long as he's moving that works. Also thanks for the offer Matthew, but Melissa figured it out.
#4
06/07/2007 (8:27 am)
Glad that worked!