commit dc65cc0f1dae77dab32f24da64ebb3151f39988a
parent 55d9ba4d717447941002be5087ae899b2d879b60
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Sun, 12 Jun 2022 14:01:51 +0100
(bunnymark) Conserve bun energy on y-bounce.
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/projects/examples/demos/bunnymark.tal b/projects/examples/demos/bunnymark.tal
@@ -86,22 +86,25 @@ BRK
[ LDA2k ] #05 SFT2 #0008 ADD2 [ .Screen/width DEI2 ] LTH2 ,&skip-max-x JCN
[ DUP2 #0004 ADD2 LDA2 ] #ffff MUL2 [ OVR2 #0004 ADD2 STA2 ]
&skip-max-x
+ ( check for left wall collision + bounce x )
+ [ LDA2k ] #0f SFT2 #0000 EQU2 ,&skip-min-x JCN
+ [ DUP2 #0004 ADD2 LDA2 ] #ffff MUL2 [ OVR2 #0004 ADD2 STA2 ]
+ &skip-min-x
( check for bottom wall collision + bounce y )
[ DUP2 #0006 ADD2 LDA2 ] #0f SFT2 #0001 EQU2 ,&skip-max-y JCN
[ INC2k INC2 LDA2 ] #05 SFT2 #0008 ADD2 [ .Screen/height DEI2 ] LTH2 ,&skip-max-y JCN
[ DUP2 #0006 ADD2 LDA2 ] #ffff MUL2 [ OVR2 #0006 ADD2 STA2 ]
+ ,&skip-gravity JMP
&skip-max-y
- ( check for left wall collision + bounce x )
- [ LDA2k ] #0f SFT2 #0000 EQU2 ,&skip-min-x JCN
- [ DUP2 #0004 ADD2 LDA2 ] #ffff MUL2 [ OVR2 #0004 ADD2 STA2 ]
- &skip-min-x
( check for top wall collision + bounce x )
[ INC2k INC2 LDA2 ] #0f SFT2 #0000 EQU2 ,&skip-min-y JCN
[ DUP2 #0006 ADD2 LDA2 ] #ffff MUL2 [ OVR2 #0006 ADD2 STA2 ]
+ ,&skip-gravity JMP
&skip-min-y
( apply gravity )
[ DUP2 #0006 ADD2 LDA2 ] #0004 ADD2 OVR2 #0006 ADD2 STA2
+ &skip-gravity
( draw the sprite )
( top )