Computing movement amount from framerate
Depending on the amount of power a computer has, the framerate will not be the same. Hence, the amount of movement of a user should be constant on each frame. If a frame was slow to print, the movement should be higher to keep a constant speed. This PR takes the framerate into account when moving the players.
This commit is contained in:
parent
0f2e21e88e
commit
46fcb86b28
2 changed files with 15 additions and 10 deletions
|
@ -182,8 +182,12 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||
});
|
||||
}
|
||||
|
||||
update() : void {
|
||||
this.CurrentPlayer.moveUser();
|
||||
/**
|
||||
* @param time
|
||||
* @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
|
||||
*/
|
||||
update(time: number, delta: number) : void {
|
||||
this.CurrentPlayer.moveUser(delta);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue