aboutsummaryrefslogtreecommitdiff
path: root/player.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-05 13:44:23 +1000
committerquou <quou@disroot.org>2023-05-05 13:44:23 +1000
commitfb104368dd33b66e0575dcc0327cbae7046a4e1e (patch)
tree67a1a66182aa8417b8fbb431576528c28f4a5ab8 /player.c
parent280552fa4750b5dac9243782f9c0a7e0b7eea6f8 (diff)
Add killing enemies.
Diffstat (limited to 'player.c')
-rw-r--r--player.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/player.c b/player.c
index b723849..b2dbf29 100644
--- a/player.c
+++ b/player.c
@@ -11,6 +11,7 @@ void init_player(Player* player, World* world) {
CSprite* sprite;
CPosition* pos;
CAnimated* animated;
+ CCollider* col;
Entity e;
e = new_entity(world);
@@ -20,11 +21,14 @@ void init_player(Player* player, World* world) {
e,
ctype_sprite |
ctype_position |
- ctype_animated
+ ctype_animated |
+ ctype_collider |
+ ctype_player
);
pos = &world->positions[e];
sprite = &world->sprites[e];
animated = &world->animateds[e];
+ col = &world->colliders[e];
pos->x = 32 << fbits;
pos->y = 70 << fbits;
@@ -36,6 +40,11 @@ void init_player(Player* player, World* world) {
animated->frame = 0;
animated->timer = 0;
+ col->x = 3 << fbits;
+ col->y = 1 << fbits;
+ col->w = 10 << fbits;
+ col->h = 15 << fbits;
+
player->face = 0;
player->shoot_cooldown = 15;
player->shoot_countdown = 0;