Major re-arrange

This commit is contained in:
stevenhowes
2021-01-31 17:43:10 +00:00
parent 475a293eb3
commit 0855690d5c
2 changed files with 81 additions and 48 deletions
Binary file not shown.
+81 -48
View File
@@ -68,59 +68,22 @@ DEF PROC_main
CLS CLS
REM Space dust / stars REM Controls
FOR Spec%=0 TO 49
GCOL 0,0
LINE SpecLocations%(0,Spec%),SpecLocations%(1,Spec%),SpecLocations%(0,Spec%),SpecLocations%(1,Spec%)
SpecLocations%(1,Spec%) = SpecLocations%(1,Spec%) - ((Cents% - LastCents%) * PlayerVelocity%/10)
IF SpecLocations%(1,Spec%) < 0 THEN
SpecLocations%(1,Spec%) = SCREENGFXHEIGHT%
SpecLocations%(0,Spec%) = RND(SCREENGFXWIDTH%)
ENDIF
NEXT Spec%
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 PROCinputs
REM Attribute names REM Environment
GCOL 0,0 PROCspacedust_draw
MOVE 75,1150
PRINT "Sheilds"
MOVE 75,1120
PRINT "Integrity"
MOVE 75,1090
PRINT "Velocity"
REM Attribute values REM NPCs
GCOL 0,7 PROCenemy_ship_move
MOVE 130,1150 PROCenemy_ship_collide
PRINT PlayerShields% PROCenemy_ship_draw
MOVE 130,1120
PRINT PlayerStructuralIntegrity%
MOVE 130,1090
PRINT PlayerVelocity%
REM Draw player ship REM Player
PROCdraw_sprite(ShipSprite$,PlayerLocation%(0),PlayerLocation%(1)) PROCplayer_ship_draw
REM UI
REM TODO: Only uses player velocity currently (/2 so they don't match stars) PROChud_draw
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%
IF DebugOut% = 1 THEN IF DebugOut% = 1 THEN
PROCdebugoutput PROCdebugoutput
@@ -139,6 +102,76 @@ DEF PROC_main
ENDPROC ENDPROC
DEF PROCspacedust_draw
REM Space dust / stars
FOR Spec%=0 TO 49
GCOL 0,0
LINE SpecLocations%(0,Spec%),SpecLocations%(1,Spec%),SpecLocations%(0,Spec%),SpecLocations%(1,Spec%)
SpecLocations%(1,Spec%) = SpecLocations%(1,Spec%) - ((Cents% - LastCents%) * PlayerVelocity%/10)
IF SpecLocations%(1,Spec%) < 0 THEN
SpecLocations%(1,Spec%) = SCREENGFXHEIGHT%
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 Attribute names
GCOL 0,0
MOVE 75,1150
PRINT "Sheilds"
MOVE 75,1120
PRINT "Integrity"
MOVE 75,1090
PRINT "Velocity"
REM Attribute values
GCOL 0,7
MOVE 130,1150
PRINT PlayerShields%
MOVE 130,1120
PRINT PlayerStructuralIntegrity%
MOVE 130,1090
PRINT PlayerVelocity%
ENDPROC
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
PROCdraw_sprite(EnemySprites$(Enemy%),EnemyLocations%(Enemy%,0),EnemyLocations%(Enemy%,1))
NEXT Enemy%
ENDPROC
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
PROCdraw_sprite(ShipSprite$,PlayerLocation%(0),PlayerLocation%(1))
ENDPROC
REM Input handling REM Input handling
DEF PROCinputs DEF PROCinputs
*FX 4 *FX 4