Collision detection is working

This commit is contained in:
Devine Lu Linvega 2023-05-22 16:44:50 -07:00
parent f01eee7482
commit f7123322fd
1 changed files with 11 additions and 2 deletions

View File

@ -53,15 +53,23 @@ BRK
@pick ( x y -- <block>* ) @pick ( x y -- <block>* )
( clamp )
DUP #04 GTH ?&bounds
OVR #03 GTH ?&bounds
,&t STR2 ,&t STR2
#0900 #0900
&l &l
#00 OVR #0006 MUL2 ;game ADD2 [ LIT2 &t $2 ] is-at ?&found #00 OVR #0006 MUL2 ;game ADD2 [ LIT2 &t $2 ] is-at ?&found
INC GTHk ?&l INC GTHk ?&l
&end
POP2 POP2
#ffff #ffff
JMP2r JMP2r
&bounds ( bounds* -- 0* )
POP2 #0000
JMP2r
&found ( bounds* -- block* ) &found ( bounds* -- block* )
NIP #00 SWP #0006 MUL2 ;game ADD2 NIP #00 SWP #0006 MUL2 ;game ADD2
JMP2r JMP2r
@ -77,8 +85,9 @@ JMP2r
@try-move ( x y -- ) @try-move ( x y -- )
pick DUP2 #ffff EQU2 ?&blank pick
OVR2 phex #0a18 DEO DUP2 #ffff EQU2 ?&blank
DUP2 #0000 EQU2 ?&blank
( up ) ( up )
DUP2 #00ff can-move phex/b #0a18 DEO DUP2 #00ff can-move phex/b #0a18 DEO
( right ) ( right )