• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android character moving problem, so weird[SOLVED]

K

Kasra

Guest
Hi there
problem start since i change my character movement based on time instead frame. and now my character shakes while moving and idk why ?

Code:
move_towards_point(global.xtg, global.ytg, speed * (deltatime/1000000);
After Add "*(deltatime/1000000)" problem began.
 
Last edited by a moderator:

YoSniper

Member
This is all about conversion factors. The resultant calculated "speed" you get is in pixels per step.

We have seconds per step as measured by delta_time / 1000000 (make sure you have the underscore, and the correct number of zeros.)
We have the default speed in pixels per step

We need pixels per second

Try:
Code:
 var modified_speed = speed * 1000000 / delta_time; //Basically inverse of what you have now.
//Pixels per second = (Pixels per step) / (seconds per step)
move_towards_point(global.xtg, global.ytg, modified_speed);
 
K

Kasra

Guest
This is all about conversion factors. The resultant calculated "speed" you get is in pixels per step.

We have seconds per step as measured by delta_time / 1000000 (make sure you have the underscore, and the correct number of zeros.)
We have the default speed in pixels per step

We need pixels per second

Try:
Code:
 var modified_speed = speed * 1000000 / delta_time; //Basically inverse of what you have now.
//Pixels per second = (Pixels per step) / (seconds per step)
move_towards_point(global.xtg, global.ytg, modified_speed);
my calculation result is not worng, i found out my delta time is changing between 0.1 and 0.2 each frame (60FPS), wich is the game maker bug, cuz delta time is a built in variable, after save my project as another file and reopen it, movement shake fixed
 
Top