Skip to content

Commit

Permalink
🏗️ Now uses entity's function for moving
Browse files Browse the repository at this point in the history
  • Loading branch information
Coul33t committed Jun 20, 2024
1 parent 101a275 commit dbab611
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions oboyrog/input_handler.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include "input_handler.h"

void handle_input(char input, struct Entity* player) {
void handle_input(char input, Entity* player) {
if (input == 'z') {
player->pos.y -= 1;
move_entity(player, NORTH);
}

else if (input == 's') {
player->pos.y += 1;
move_entity(player, SOUTH);
}

else if (input == 'd') {
player->pos.x += 1;
move_entity(player, EAST);
}

else if (input == 'q') {
player->pos.x -= 1;
move_entity(player, WEST);
}
}
2 changes: 1 addition & 1 deletion oboyrog/input_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "entity.h"

void handle_input(char input, struct Entity* player);
void handle_input(char input, Entity* player);

#endif

0 comments on commit dbab611

Please sign in to comment.