shit!
This commit is contained in:
parent
1702a06d9f
commit
364a34ce33
20 changed files with 453 additions and 64 deletions
38
src/player.h
38
src/player.h
|
|
@ -9,8 +9,8 @@
|
|||
#define PLAYER_BOUND_Y FIX32(PLAYER_OFF)
|
||||
#define PLAYER_BOUND_H FIX32(224 - PLAYER_OFF)
|
||||
|
||||
#define CAMERA_X FIX32(80)
|
||||
#define CAMERA_W FIX32(240)
|
||||
#define CAMERA_X FIX32(96)
|
||||
#define CAMERA_W FIX32(224)
|
||||
|
||||
#define SHOT_INTERVAL 15
|
||||
|
||||
|
|
@ -106,7 +106,10 @@ static void shootPlayer(){
|
|||
.angle = player.shotAngle,
|
||||
.player = TRUE
|
||||
};
|
||||
spawnBullet(spawner, EMPTY);
|
||||
void updater(s16 i){
|
||||
if(bullets[i].clock == 5) killBullet(i, TRUE);
|
||||
}
|
||||
spawnBullet(spawner, updater);
|
||||
sfxPlayerShot();
|
||||
shotClock = SHOT_INTERVAL;
|
||||
} else if(shotClock > 0) shotClock--;
|
||||
|
|
@ -127,16 +130,21 @@ void loadPlayer(){
|
|||
}
|
||||
|
||||
void updatePlayer(){
|
||||
movePlayer();
|
||||
boundsPlayer();
|
||||
cameraPlayer();
|
||||
shootPlayer();
|
||||
|
||||
s16 sx = getScreenX(player.pos.x, player.camera);
|
||||
s16 sy = fix32ToInt(player.pos.y);
|
||||
|
||||
|
||||
SPR_setPosition(player.image, sx - PLAYER_OFF, sy - PLAYER_OFF);
|
||||
|
||||
intToStr(fix32ToInt(player.pos.x), debugStr, 1);
|
||||
if(!gameOver){
|
||||
if(player.recoveringClock > 0){
|
||||
if(player.recoveringClock % 10 == 1)
|
||||
SPR_setVisibility(player.image, player.recoveringClock % 20 == 1 ? VISIBLE : HIDDEN);
|
||||
player.recoveringClock--;
|
||||
if(player.recoveringClock == 0)
|
||||
SPR_setVisibility(player.image, VISIBLE);
|
||||
}
|
||||
movePlayer();
|
||||
boundsPlayer();
|
||||
cameraPlayer();
|
||||
shootPlayer();
|
||||
s16 sx = getScreenX(player.pos.x, player.camera);
|
||||
s16 sy = fix32ToInt(player.pos.y);
|
||||
SPR_setPosition(player.image, sx - PLAYER_OFF, sy - PLAYER_OFF);
|
||||
intToStr(fix32ToInt(player.pos.x), debugStr, 1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue