Commit 88519a27 authored by Max Kobelt's avatar Max Kobelt
Browse files

Don't create new Rectangle on every calculation step

parent 22d2f058
......@@ -26,9 +26,6 @@ void initGame() {
}
void calcGame() {
int key = GetKeyPressed();
// Control the laserCanon with left- and rightarrow
if (IsKeyDown(KEY_LEFT)) {
if (laserCanonPos.x > 0) {
laserCanonPos.x -= LASER_CANON_SPEED;
......@@ -45,8 +42,8 @@ void calcGame() {
spawnPlayerProjectile();
}
// Update position of laserCanon
laserCanon = (Rectangle) {(float) laserCanonPos.x, (float) laserCanonPos.y, (float) laserCanonSize, (float) laserCanonSize};
laserCanon.x = laserCanonPos.x;
laserCanon.y = laserCanonPos.y;
}
void drawGame() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment