Keep player ship within bounds of screen

This commit is contained in:
stevenhowes
2021-02-13 20:50:13 +00:00
parent e1ff286183
commit 1f8c0139c6
2 changed files with 8 additions and 0 deletions
Binary file not shown.
+8
View File
@@ -493,11 +493,19 @@ DEF PROCinputs
ShipSprite$ = "player_shipr" ShipSprite$ = "player_shipr"
ResetShipSprite% = Cents% + 20 ResetShipSprite% = Cents% + 20
PlayerLocation%(0) = PlayerLocation%(0) + (XMovePerCent% * (Cents% - LastCents%)) PlayerLocation%(0) = PlayerLocation%(0) + (XMovePerCent% * (Cents% - LastCents%))
IF PlayerLocation%(0) > (SCREENGFXWIDTH% - PlayerHitbox%(2)) THEN
PlayerLocation%(0) = (SCREENGFXWIDTH% - PlayerHitbox%(2))
ShipSprite$ = "player_ship"
ENDIF
ENDIF ENDIF
IF INKEY(-26) THEN IF INKEY(-26) THEN
ShipSprite$ = "player_shipl" ShipSprite$ = "player_shipl"
ResetShipSprite% = Cents% + 20 ResetShipSprite% = Cents% + 20
PlayerLocation%(0) = PlayerLocation%(0) - (XMovePerCent% * (Cents% - LastCents%)) PlayerLocation%(0) = PlayerLocation%(0) - (XMovePerCent% * (Cents% - LastCents%))
IF PlayerLocation%(0) < 0 THEN
PlayerLocation%(0) = 0
ShipSprite$ = "player_ship"
ENDIF
ENDIF ENDIF
IF INKEY(-58) THEN IF INKEY(-58) THEN
PlayerVelocity% = PlayerVelocity% + 1 PlayerVelocity% = PlayerVelocity% + 1