Commit c328e8cc authored by Max Kobelt's avatar Max Kobelt
Browse files

Separate header and implementation

parent 145dd4de
......@@ -11,4 +11,5 @@ target_sources(${PROJECT_NAME}
position.h
alien.h
projectile.h
projectile.c
)
#include "projectile.h"
#define PROJECTILE_SPEED 3
Projectile* projectileTick(Projectile *proj) {
int newY = proj->pos.y + (proj->movingUp ? -1 : 1) * PROJECTILE_SPEED;
if (newY < 0 || newY >= GAME_SCREEN_HEIGHT) {
free(proj);
return NULL;
}
proj->pos.y = newY;
}
......@@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdlib.h>
#define PROJECTILE_SPEED 3
#define PROJECTILE_HEIGHT 10
#define PROJECTILE_WIDTH 5
......@@ -16,12 +15,4 @@ typedef struct {
Vector2 pos;
} Projectile;
Projectile* projectileTick(Projectile *proj) {
int newY = proj->pos.y + (proj->movingUp ? -1 : 1) * PROJECTILE_SPEED;
if (newY < 0 || newY >= GAME_SCREEN_HEIGHT) {
free(proj);
return NULL;
}
proj->pos.y = newY;
}
Projectile* projectileTick(Projectile *proj);
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