-
sathonoLikes 0Problem Description
Im encourntering a issue caused by the frame rate of the game. My players position is updated with the following line of code:
update:function() { this.x += this.dx; this.y += this.dy; }
This works well however I have noticed that if the frame rate ever lowers down to about 30-50, the speed of the player is significantly reduced. This causes major issues because some of the objects which are moved using the MoveTo action are not effected by the frame rate change. This makes the objects in the game to become unsynced and causes issues. I am looking to always have the player move at the same speed, even if the frame rate lowers.
I believe the x position of the player will have to be updated based on the delta X and the current frame rate. Same for the y position.
Is this the appropriate way of solving this problem? If it is I would be more then appreciative to have a example provided as I have never worked with this type of error before.
Thanks!
-
Sonar Systems adminLikes 0
Here is a link to our Cocos API Guide which will help you get delta time to fix this issue http://cocos.sonarlearning.co.uk/docs/scheduling-methods
Feel free to post any future question you may have.
Login to reply