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 19:26:14 +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
|
|
|
|
2023-07-07 19:26:14 +02:00
|
|
|
|
|
|
|
#ifdef FXCG50
|
|
|
|
#define SPEED 3
|
|
|
|
#else
|
|
|
|
#define SPEED 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
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) {
|
2023-07-07 19:26:14 +02:00
|
|
|
if(MyPlayer.x >= SPEED){
|
|
|
|
MyPlayer.x-=SPEED;
|
2023-07-07 14:50:30 +02:00
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerRight(void) {
|
2023-07-07 19:26:14 +02:00
|
|
|
if(MyPlayer.x <= map_level->w * T_WIDTH - SPEED){
|
|
|
|
MyPlayer.x+=SPEED;
|
2023-07-07 14:50:30 +02:00
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerUp(void) {
|
2023-07-07 19:26:14 +02:00
|
|
|
if(MyPlayer.y >= SPEED){
|
|
|
|
MyPlayer.y-=SPEED;
|
2023-07-07 14:50:30 +02:00
|
|
|
}
|
2023-07-06 22:02:37 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 14:50:30 +02:00
|
|
|
void PlayerDown(void) {
|
2023-07-07 19:26:14 +02:00
|
|
|
if(MyPlayer.y <= map_level->h * T_HEIGHT - SPEED){
|
|
|
|
MyPlayer.y+=SPEED;
|
2023-07-07 14:50:30 +02:00
|
|
|
}
|
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
|
|
|
}
|