diff options
-rw-r--r-- | player.cpp | 5 | ||||
-rw-r--r-- | textures/player.png | bin | 799 -> 1172 bytes |
2 files changed, 3 insertions, 2 deletions
@@ -8,6 +8,7 @@ #include "player.h" #include "texturesdl.h" +#include "config.h" Player::Player() { x = 0.5; @@ -43,6 +44,6 @@ void Player::update() { y_speed /= sqrtf(2); } - x += x_speed; - y += y_speed; + x = fmaxf(fminf(x + x_speed, 1.0 - 16.0 / Config::viewport_w), 16.0 / Config::viewport_w); + y = fmaxf(fminf(y + y_speed, Config::viewport_aspect - 16.0 / Config::viewport_h), 16.0 / Config::viewport_h); } diff --git a/textures/player.png b/textures/player.png Binary files differindex 2c21d21..33e9154 100644 --- a/textures/player.png +++ b/textures/player.png |