mirror of
https://github.com/stevenhowes/CTheEscape.git
synced 2026-05-26 15:53:29 +01:00
Return ship to idle sprite when movement finished.
This commit is contained in:
Binary file not shown.
+8
-2
@@ -56,8 +56,10 @@ struct Star_s {
|
|||||||
|
|
||||||
struct Player_s {
|
struct Player_s {
|
||||||
struct EntityLocation_s location;
|
struct EntityLocation_s location;
|
||||||
|
enum sprite_e idlesprite;
|
||||||
enum sprite_e sprite;
|
enum sprite_e sprite;
|
||||||
unsigned char velocity;
|
unsigned char velocity;
|
||||||
|
int nextidlesprite;
|
||||||
int shields;
|
int shields;
|
||||||
int integrity;
|
int integrity;
|
||||||
int remainingdistance;
|
int remainingdistance;
|
||||||
@@ -215,6 +217,7 @@ void game_setup_player()
|
|||||||
Player.location.X = DISPLAY_X/2;
|
Player.location.X = DISPLAY_X/2;
|
||||||
Player.location.Y = PLAYER_Y_START;
|
Player.location.Y = PLAYER_Y_START;
|
||||||
Player.sprite = player_ship;
|
Player.sprite = player_ship;
|
||||||
|
Player.idlesprite = player_ship;
|
||||||
Player.velocity = 100;
|
Player.velocity = 100;
|
||||||
Player.shields = 100;
|
Player.shields = 100;
|
||||||
Player.integrity = 50;
|
Player.integrity = 50;
|
||||||
@@ -314,16 +317,19 @@ void game_input_tick()
|
|||||||
debugs[dbbase] = 1;
|
debugs[dbbase] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tick > Player.nextidlesprite)
|
||||||
|
Player.sprite = Player.idlesprite;
|
||||||
|
|
||||||
// Right arrow
|
// Right arrow
|
||||||
if(input_readkey(121))
|
if(input_readkey(121))
|
||||||
{
|
{
|
||||||
Player.location.X += PLAYER_X_SPEED * (tick - lasttick);
|
Player.location.X += PLAYER_X_SPEED * (tick - lasttick);
|
||||||
Player.sprite = player_shipr;
|
Player.sprite = player_shipr;
|
||||||
|
Player.nextidlesprite = tick + 15;
|
||||||
// TODO: SHIP WIDTH
|
// TODO: SHIP WIDTH
|
||||||
if((Player.location.X + Player.hitbox_tr.X) > DISPLAY_X)
|
if((Player.location.X + Player.hitbox_tr.X) > DISPLAY_X)
|
||||||
{
|
{
|
||||||
Player.location.X = DISPLAY_X - Player.hitbox_tr.X;
|
Player.location.X = DISPLAY_X - Player.hitbox_tr.X;
|
||||||
Player.sprite = player_ship;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,10 +338,10 @@ void game_input_tick()
|
|||||||
{
|
{
|
||||||
Player.location.X -= PLAYER_X_SPEED * (tick - lasttick);
|
Player.location.X -= PLAYER_X_SPEED * (tick - lasttick);
|
||||||
Player.sprite = player_shipl;
|
Player.sprite = player_shipl;
|
||||||
|
Player.nextidlesprite = tick + 15;
|
||||||
if((Player.location.X + Player.hitbox_bl.X) < 0)
|
if((Player.location.X + Player.hitbox_bl.X) < 0)
|
||||||
{
|
{
|
||||||
Player.location.X = 0 - Player.hitbox_bl.X;
|
Player.location.X = 0 - Player.hitbox_bl.X;
|
||||||
Player.sprite = player_ship;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user