summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--player.cpp5
-rw-r--r--textures/player.pngbin799 -> 1172 bytes
2 files changed, 3 insertions, 2 deletions
diff --git a/player.cpp b/player.cpp
index 0a7118a..2ab07de 100644
--- a/player.cpp
+++ b/player.cpp
@@ -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
index 2c21d21..33e9154 100644
--- a/textures/player.png
+++ b/textures/player.png
Binary files differ