(lander) Basic controls

This commit is contained in:
Devine Lu Linvega 2023-06-10 21:09:31 -07:00
parent fdcb0103bb
commit 2a5500f099
1 changed files with 43 additions and 20 deletions

View File

@ -25,6 +25,9 @@
( vectors )
;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2
#0100 .pos/x STZ2
#00a0 .pos/y STZ2
redraw
BRK
@ -38,23 +41,18 @@ BRK
#01 AND ?&no-read
.Controller/button DEI
DUP #10 NEQ ?&no-u
.angle LDZ2
#10 SFT2 ;circle-tbl ADD2 LDA2 SWP
( y )
#0000 ROT #00 SWP SUB2 reduce2
.force/y LDZ2 ADD2
.force/y STZ2
( y )
#0000 ROT #00 SWP SUB2 reduce2
.force/x LDZ2 ADD2
.force/x STZ2
.angle LDZ2 thruster
&no-u
DUP #20 NEQ ?&no-d
#0010 .force/y STZ2
&no-d
DUP #40 NEQ ?&no-l
.angle LDZ2 #0001 SUB2 #001f AND2 .angle STZ2
;draw-lander/plume LDA INC ;draw-lander/plume STA
&no-l
DUP #80 NEQ ?&no-r
.angle LDZ2 INC2 #001f AND2 .angle STZ2
;draw-lander/plume LDA INC ;draw-lander/plume STA
&no-r
@ -74,11 +72,29 @@ BRK
(
@|core )
@thruster ( angle* -- )
#10 SFT2 ;circle-tbl ADD2 LDA2 POP
( make short )
#80 SUB
DUP #80 AND #00 NEQ STH #ff00 STHr JMP SWP POP SWP
reduce3 .force/x LDZ2 ADD2 .force/x STZ2
.angle LDZ2 #0020 ADD2 #001f AND2 #10 SFT2 ;circle-tbl ADD2 LDA2 NIP
( make short )
#80 ADD
DUP #80 AND #00 NEQ STH #ff00 STHr JMP SWP POP SWP
reduce3
.force/y LDZ2 ADD2 .force/y STZ2
JMP2r
@apply-force ( -- )
.force/y LDZ2 INC2 .force/y STZ2
[ LIT &f $1 ] INCk ,&f STR
#03 AND ?&skip
.force/y LDZ2 INC2 .force/y STZ2
&skip
.force/y LDZ2 reduce .pos/y LDZ2 ADD2 .pos/y STZ2
.force/x LDZ2 reduce .pos/x LDZ2 ADD2 .pos/x STZ2
JMP2r
@ -86,16 +102,25 @@ JMP2r
@reduce ( force* -- )
DUP2 #8000 AND2 ORA ?&neg
#02 SFT2
#01 SFT2
JMP2r
&neg abs2 #02 SFT2 #0000 SWP2 SUB2 JMP2r
&neg abs2 #01 SFT2 #0000 SWP2 SUB2 JMP2r
@reduce2 ( force* -- )
DUP2 #8000 AND2 ORA ?&neg
#05 SFT2
#0001 SUB2
JMP2r
&neg abs2 #05 SFT2 #0000 SWP2 SUB2 JMP2r
&neg abs2 #0001 SUB2 #0000 SWP2 SUB2 JMP2r
@reduce3 ( force* -- )
DUP2 #8000 AND2 ORA ?&neg
#0020 DIV2
JMP2r
&neg abs2 #0020 DIV2 #0000 SWP2 SUB2 JMP2r
(
@|drawing )
@ -226,9 +251,7 @@ JMP2r
0000 0000 8040 2010 0911 1212 1212 1109
0000 0042 0042 3c00 9088 4848 4848 8890
0804 0201 0000 0000 c33c 0081 7e00 0000
1020 4080 0000 0000
]
1020 4080 0000 0000 ]
@circle-tbl [
8000 9802 b009 c715 da25 ea38 f64f fd67