Collab_RPG/src/player.c

53 lines
803 B
C
Raw Normal View History

#include "player.h"
#include "map.h"
#include <gint/display.h>
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 19:26:14 +02:00
#ifdef FXCG50
#define SPEED 3
#else
#define SPEED 1
#endif
extern Player MyPlayer;
2023-07-07 14:50:30 +02:00
extern Map *map_level;
extern bopti_image_t demo_player_img;
2023-07-07 14:50:30 +02:00
void PlayerDraw(void) {
dimage(MyPlayer.px-P_WIDTH/2, MyPlayer.py-P_HEIGHT/2, &demo_player_img);
}
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-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-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-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-07 14:50:30 +02:00
void PlayerAction(void) {
}