2023-07-06 22:02:37 +02:00
|
|
|
#include "player.h"
|
|
|
|
#include "map.h"
|
2023-07-07 14:20:13 +02:00
|
|
|
#include <gint/display.h>
|
2023-07-06 22:02:37 +02:00
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
#define P_WIDTH 8
|
|
|
|
#define P_HEIGHT 8
|
2023-07-07 14:20:13 +02:00
|
|
|
|
|
|
|
extern Player MyPlayer;
|
2023-07-07 14:50:30 +02:00
|
|
|
extern Map *map_level;
|
2023-07-07 14:20:13 +02:00
|
|
|
extern bopti_image_t demo_player_img;
|
2023-07-06 22:02:37 +02:00
|
|
|
|
2023-07-07 18:22:39 +02:00
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerDraw(void) {
|
2023-07-07 14:20:13 +02:00
|
|
|
dimage(MyPlayer.px-P_WIDTH/2, MyPlayer.py-P_HEIGHT/2, &demo_player_img);
|
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerLeft(void) {
|
|
|
|
if(MyPlayer.x > 0){
|
|
|
|
MyPlayer.x--;
|
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerRight(void) {
|
|
|
|
if(MyPlayer.x < map_level->w * T_WIDTH){
|
|
|
|
MyPlayer.x++;
|
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerUp(void) {
|
|
|
|
if(MyPlayer.y > 0){
|
|
|
|
MyPlayer.y--;
|
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerDown(void) {
|
|
|
|
if(MyPlayer.y < map_level->h * T_HEIGHT){
|
|
|
|
MyPlayer.y++;
|
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerAction(void) {
|
2023-07-06 22:02:37 +02:00
|
|
|
|
2023-07-07 14:20:13 +02:00
|
|
|
}
|