Choppy performance, debug mode?
by Scott Jaworski · in Torque Game Builder · 08/29/2006 (6:37 am) · 2 replies
I'm playing through my game as I'm developing it to see how it runs. I've got a little player that I can move around and a small map loaded (20 x 20 static sprites placed together to make a full map). When I move the player, it jerks. I dont' know how else to explain it. It'll move forward a few places correctly and then jump forward a couple more places, repeatedly. I'm not running any heavy code (just a move function similar to any of the movement tutorials). Any ideas on what could be causing this jumpiness, almost like a frame rate issue? Is it possible that I'm running in some sort of debug mode that makes things run slower? I notice that when I package the game to give to others to test, it's still got the console when you press ~.
Pointing me in the right direction at least would be very helpful. Thanks.
Pointing me in the right direction at least would be very helpful. Thanks.
#2
That function is mapped to the Up key. Should I be doing something to ignore the function if we're already moving? (Is the function perhaps being called repeatedly if the user holds the button down?)
09/02/2006 (9:46 am)
I'm using the setLinearVelocity functions:function heliPlayerForward()
{
switch($heliPlayer.direction)
{
case 1: %x=0; %y=-75;
case 2: %x=100; %y=-50;
case 3: %x=150; %y=0;
case 4: %x=100; %y=50;
case 5: %x=0; %y=75;
case 6: %x=-100; %y=50;
case 7: %x=-150; %y=0;
case 8: %x=-100; %y=-50;
}
$heliPlayer.setLinearVelocityY(%y);
$heliPlayer.setLinearVelocityX(%x);
}That function is mapped to the Up key. Should I be doing something to ignore the function if we're already moving? (Is the function perhaps being called repeatedly if the user holds the button down?)
Torque Owner Tim Saunders
If you are using setPosition() all the time to move then it will appear jerky.
You should use setLinearVelocity() instead to make it nice and smooth (or setLinearVelocityX() and setLinearVelocityY() for the individual components).