uxn/projects/examples/demos/move.tal

75 lines
1.6 KiB
Tal
Raw Normal View History

( devices )
2022-03-14 03:32:32 +00:00
|0000 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|0020 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0080 @Controller &vector $2 &button $1 &key $1
|0000
2021-04-20 04:33:52 +00:00
@slime $1
2021-03-14 01:34:08 +00:00
2022-03-14 03:32:32 +00:00
|0100 ( -> ) @program
2021-04-20 04:00:14 +00:00
2022-03-14 03:32:32 +00:00
( theme )
#0daf .System/r DEO2
#02ff .System/g DEO2
#035f .System/b DEO2
2022-03-14 03:32:32 +00:00
( vectors )
;on-frame .Screen/vector DEO2
2021-03-14 01:34:08 +00:00
( set origin )
2022-03-14 03:32:32 +00:00
.Screen/width DEI2 #01 SFT2 .Screen/x DEO2
.Screen/height DEI2 #01 SFT2 .Screen/y DEO2
( defaults )
;default-icn .Screen/addr DEO2
#41 .Screen/sprite DEO
#0a .slime STZ
2021-03-14 01:34:08 +00:00
BRK
2021-04-21 16:48:04 +00:00
@on-frame ( -> )
2021-03-15 00:32:40 +00:00
#0a .slime STZ
2022-03-14 03:32:32 +00:00
;default-icn .Screen/addr DEO2
2021-03-14 01:34:08 +00:00
( hold ctrl key to change slime color )
.Controller/button DEI #0f AND
DUP #01 NEQ ,&no-ctrl JCN #05 .slime STZ &no-ctrl
DUP #02 NEQ ,&no-alt JCN #0f .slime STZ &no-alt
2021-03-15 00:32:40 +00:00
POP
2022-03-14 03:32:32 +00:00
( clear )
#40 .Screen/sprite DEO
2021-03-15 00:32:40 +00:00
( detect movement )
2022-03-14 03:32:32 +00:00
.Controller/button DEI
DUP #10 AND #00 EQU ,&no-up JCN
.Screen/y DEI2 #0001 SUB2 .Screen/y DEO2
;up-icn .Screen/addr DEO2 &no-up
DUP #20 AND #00 EQU ,&no-down JCN
.Screen/y DEI2 INC2 .Screen/y DEO2
;down-icn .Screen/addr DEO2 &no-down
DUP #40 AND #00 EQU ,&no-left JCN
.Screen/x DEI2 #0001 SUB2 .Screen/x DEO2
;left-icn .Screen/addr DEO2 &no-left
DUP #80 AND #00 EQU ,&no-right JCN
.Screen/x DEI2 INC2 .Screen/x DEO2
;right-icn .Screen/addr DEO2 &no-right
2021-03-15 00:32:40 +00:00
POP
2021-03-14 01:34:08 +00:00
( draw face )
#41 .Screen/sprite DEO
2021-03-14 01:34:08 +00:00
( draw slime )
2022-03-14 03:32:32 +00:00
;slime-icn .Screen/addr DEO2
.slime LDZ .Screen/sprite DEO
2021-03-14 01:34:08 +00:00
2021-03-15 00:32:40 +00:00
BRK
2021-03-14 01:34:08 +00:00
2022-03-14 03:32:32 +00:00
@default-icn
3c7e ffdb ffe7 7e3c
@up-icn
2466 e7db ffff 7e3c
@down-icn
3c7e ffff dbe7 6624
@left-icn
3c7e ef1f 1fef 7e3c
@right-icn
3c7e f7f8 f8f7 7e3c
@slime-icn
0000 183c 3c18 0000