mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-04-20 01:47:34 +02:00
added speed parameter for player
This commit is contained in:
parent
ac9f17bd75
commit
c87580130d
1 changed files with 17 additions and 8 deletions
25
src/player.c
25
src/player.c
|
@ -2,9 +2,18 @@
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
|
|
||||||
|
|
||||||
#define P_WIDTH 8
|
#define P_WIDTH 8
|
||||||
#define P_HEIGHT 8
|
#define P_HEIGHT 8
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FXCG50
|
||||||
|
#define SPEED 3
|
||||||
|
#else
|
||||||
|
#define SPEED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern Player MyPlayer;
|
extern Player MyPlayer;
|
||||||
extern Map *map_level;
|
extern Map *map_level;
|
||||||
extern bopti_image_t demo_player_img;
|
extern bopti_image_t demo_player_img;
|
||||||
|
@ -15,26 +24,26 @@ void PlayerDraw(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerLeft(void) {
|
void PlayerLeft(void) {
|
||||||
if(MyPlayer.x > 0){
|
if(MyPlayer.x >= SPEED){
|
||||||
MyPlayer.x--;
|
MyPlayer.x-=SPEED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerRight(void) {
|
void PlayerRight(void) {
|
||||||
if(MyPlayer.x < map_level->w * T_WIDTH){
|
if(MyPlayer.x <= map_level->w * T_WIDTH - SPEED){
|
||||||
MyPlayer.x++;
|
MyPlayer.x+=SPEED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerUp(void) {
|
void PlayerUp(void) {
|
||||||
if(MyPlayer.y > 0){
|
if(MyPlayer.y >= SPEED){
|
||||||
MyPlayer.y--;
|
MyPlayer.y-=SPEED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerDown(void) {
|
void PlayerDown(void) {
|
||||||
if(MyPlayer.y < map_level->h * T_HEIGHT){
|
if(MyPlayer.y <= map_level->h * T_HEIGHT - SPEED){
|
||||||
MyPlayer.y++;
|
MyPlayer.y+=SPEED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue