aboutsummaryrefslogtreecommitdiff
path: root/player.c
diff options
context:
space:
mode:
Diffstat (limited to 'player.c')
-rw-r--r--player.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/player.c b/player.c
index d79beed..4a82cff 100644
--- a/player.c
+++ b/player.c
@@ -26,7 +26,8 @@ void init_player(Player* player, World* world) {
ctype_position |
ctype_animated |
ctype_collider |
- ctype_player
+ ctype_player |
+ ctype_moveable
);
pos = &world->positions[e];
sprite = &world->sprites[e];
@@ -55,7 +56,7 @@ void init_player(Player* player, World* world) {
}
void update_player(Player* player, World* world) {
- int dx, dy, cbx, cby;
+ int dx, dy;
int face, moving = 0;
Entity e;
CPosition* pos;
@@ -132,6 +133,19 @@ void update_player(Player* player, World* world) {
game_change_state(&game, game_state_dead);
}
+ player->shoot_countdown--;
+}
+
+void player_take_damage(Player* player, int dmg) {
+ player->hp -= dmg;
+}
+
+void update_camera(Player* player, World* world) {
+ const CPosition* pos;
+ int cbx, cby;
+
+ pos = &world->positions[player->entity];
+
world->cam_x = pos->x - ((renderer_w / 2) << fbits);
world->cam_y = pos->y - ((renderer_h / 2) << fbits);
@@ -151,10 +165,4 @@ void update_player(Player* player, World* world) {
if (world->cam_y > cby) {
world->cam_y = cby;
}
-
- player->shoot_countdown--;
-}
-
-void player_take_damage(Player* player, int dmg) {
- player->hp -= dmg;
}