mirror of
https://github.com/stevenhowes/TheEscape.git
synced 2026-05-26 15:53:26 +01:00
Major re-arrange
This commit is contained in:
Binary file not shown.
@@ -68,6 +68,41 @@ DEF PROC_main
|
||||
|
||||
CLS
|
||||
|
||||
REM Controls
|
||||
PROCinputs
|
||||
|
||||
REM Environment
|
||||
PROCspacedust_draw
|
||||
|
||||
REM NPCs
|
||||
PROCenemy_ship_move
|
||||
PROCenemy_ship_collide
|
||||
PROCenemy_ship_draw
|
||||
|
||||
REM Player
|
||||
PROCplayer_ship_draw
|
||||
|
||||
REM UI
|
||||
PROChud_draw
|
||||
|
||||
IF DebugOut% = 1 THEN
|
||||
PROCdebugoutput
|
||||
ENDIF
|
||||
|
||||
REM Wait for rendering to complete
|
||||
WAIT
|
||||
|
||||
REM Display edited buffer
|
||||
SYS "OS_Byte",113,Scr%
|
||||
|
||||
REM Switch draw buffer
|
||||
IF Scr%=0 THEN Scr%=1 ELSE Scr%=0
|
||||
|
||||
UNTIL FALSE
|
||||
|
||||
ENDPROC
|
||||
|
||||
DEF PROCspacedust_draw
|
||||
REM Space dust / stars
|
||||
FOR Spec%=0 TO 49
|
||||
GCOL 0,0
|
||||
@@ -78,18 +113,25 @@ DEF PROC_main
|
||||
SpecLocations%(0,Spec%) = RND(SCREENGFXWIDTH%)
|
||||
ENDIF
|
||||
NEXT Spec%
|
||||
ENDPROC
|
||||
|
||||
REM Move enemy ship (display and physical)
|
||||
DEF PROCenemy_ship_move
|
||||
REM TODO: Only uses player velocity currently (/2 so they don't match stars)
|
||||
FOR Enemy%=0 TO MaxEnemies% - 1
|
||||
EnemyLocations%(Enemy%,1) = EnemyLocations%(Enemy%,1) - ((Cents% - LastCents%) * PlayerVelocity%/20)
|
||||
IF EnemyLocations%(Enemy%,1) < 0 THEN
|
||||
EnemyLocations%(Enemy%,1) = SCREENGFXHEIGHT% + RND(SCREENGFXHEIGHT%)
|
||||
EnemyLocations%(Enemy%,0) = RND(SCREENGFXWIDTH%)
|
||||
ENDIF
|
||||
NEXT Enemy%
|
||||
ENDPROC
|
||||
|
||||
REM Hud drawing (sprites and real-time)
|
||||
DEF PROChud_draw
|
||||
REM Draw LCARS in top left
|
||||
PROCdraw_sprite("lcars",4,SCREENGFXHEIGHT%-180)
|
||||
|
||||
REM If using l/r sprites we debounce to stop it looking twitchy
|
||||
IF Cents% > ResetShipSprite% THEN
|
||||
ShipSprite$ = "player_ship"
|
||||
ENDIF
|
||||
|
||||
REM Handle Key inputs
|
||||
PROCinputs
|
||||
|
||||
REM Attribute names
|
||||
GCOL 0,0
|
||||
MOVE 75,1150
|
||||
@@ -107,36 +149,27 @@ DEF PROC_main
|
||||
PRINT PlayerStructuralIntegrity%
|
||||
MOVE 130,1090
|
||||
PRINT PlayerVelocity%
|
||||
ENDPROC
|
||||
|
||||
REM Draw player ship
|
||||
PROCdraw_sprite(ShipSprite$,PlayerLocation%(0),PlayerLocation%(1))
|
||||
|
||||
REM Handle enemy collisions with anything
|
||||
DEF PROCenemy_ship_collide
|
||||
ENDPROC
|
||||
|
||||
REM Draw enemy ships
|
||||
DEFPROCenemy_ship_draw
|
||||
REM TODO: Only uses player velocity currently (/2 so they don't match stars)
|
||||
FOR Enemy%=0 TO MaxEnemies% - 1
|
||||
EnemyLocations%(Enemy%,1) = EnemyLocations%(Enemy%,1) - ((Cents% - LastCents%) * PlayerVelocity%/20)
|
||||
IF EnemyLocations%(Enemy%,1) < 0 THEN
|
||||
EnemyLocations%(Enemy%,1) = SCREENGFXHEIGHT% + RND(SCREENGFXHEIGHT%)
|
||||
EnemyLocations%(Enemy%,0) = RND(SCREENGFXWIDTH%)
|
||||
ENDIF
|
||||
PROCdraw_sprite(EnemySprites$(Enemy%),EnemyLocations%(Enemy%,0),EnemyLocations%(Enemy%,1))
|
||||
NEXT Enemy%
|
||||
ENDPROC
|
||||
|
||||
IF DebugOut% = 1 THEN
|
||||
PROCdebugoutput
|
||||
REM Draw player ship
|
||||
DEF PROCplayer_ship_draw
|
||||
REM If using l/r sprites we debounce to stop it looking twitchy
|
||||
IF Cents% > ResetShipSprite% THEN
|
||||
ShipSprite$ = "player_ship"
|
||||
ENDIF
|
||||
|
||||
REM Wait for rendering to complete
|
||||
WAIT
|
||||
|
||||
REM Display edited buffer
|
||||
SYS "OS_Byte",113,Scr%
|
||||
|
||||
REM Switch draw buffer
|
||||
IF Scr%=0 THEN Scr%=1 ELSE Scr%=0
|
||||
|
||||
UNTIL FALSE
|
||||
|
||||
PROCdraw_sprite(ShipSprite$,PlayerLocation%(0),PlayerLocation%(1))
|
||||
ENDPROC
|
||||
|
||||
REM Input handling
|
||||
|
||||
Reference in New Issue
Block a user