My code to move the sprite up and down (Y) is this:
when SF::Keyboard::Down
position = sprite.position
sprite.move(SF.vector2(position.x, position.y - 1))
window.clear
window.draw(sprite)
window.display
when SF::Keyboard::Up
position = sprite.position
sprite.move(SF.vector2(position.x, position.y + 1))
window.clear
window.draw(sprite)
window.display
Now, it seems that the - part is not affecting the sprite position at all, and the sprite position will only increase, and not by 1 at a time but by x2, here is print of the position:
My code to move the sprite up and down (Y) is this:
Now, it seems that the
-
part is not affecting the sprite position at all, and the sprite position will only increase, and not by 1 at a time but byx2
, here is print of the position:What am I missing ? :)