29 lines
614 B
C
29 lines
614 B
C
/**** player.c - player creation, movement, etc. functions
|
|
This file contains the functions for initializing and commanding the player.
|
|
|
|
****/
|
|
#include "player.h"
|
|
#include "game.h"
|
|
|
|
void playerSetCommand(int command_id, void(*function)) {
|
|
player_commands[command_id] = function;
|
|
}
|
|
|
|
/* in-game movement stuff */
|
|
void playerMove(int direction, int distance) {
|
|
switch(direction) {
|
|
case NORTH:
|
|
player.y -= distance;
|
|
break;
|
|
case SOUTH:
|
|
player.y += distance;
|
|
break;
|
|
case EAST:
|
|
player.x += distance;
|
|
break;
|
|
case WEST:
|
|
player.x -= distance;
|
|
break;
|
|
}
|
|
}
|