[Solved] moving sprite away from (0,0) is slower

[Solved] moving sprite away from (0,0) is slower
0.0 0



I am new to cocos2d-x and also not experienced in coding platform-games.
I have a small problem:

Basically, I programmed a Sprite that can be moved around in 4 directions with the Arrow keys.
The Problem is, moving it ‘right’ and ‘up’ is faster than ‘down’ and ‘left’.

(Bottom left is the (0,0) point of the cocos2d canvas, maybe it
has something to do with it ?)

I programmed it more or less like in the “MoonWarriors” example,
which means i use something like this

this.newPosY += dt * this.speed;

inside an update function.

Also, the sprite has an animation which changes on each direction:

this.runAction(cc.RepeatForever.create(cc.Animate.create(this.animationspeed, this.animation_walk_up, true)));

Maybe someone can help me or point me into the right direction?




Hi, found the problem:
I was using Math.floor() when setting the Sprites position, which leads to this behaviour of course.