0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-08 15:25:05 +00:00
uxn/projects/examples/dev.controller.usm

71 lines
1.6 KiB
Text
Raw Normal View History

2021-03-14 01:34:08 +00:00
( Controller )
2021-03-16 18:25:26 +00:00
%++ { #0001 ADD2 }
%-- { #0001 SUB2 }
%2/ { #0002 DIV2 }
2021-03-15 00:32:40 +00:00
2021-03-14 01:34:08 +00:00
;slime { color 1 }
|0100 @RESET
( set origin )
2021-03-16 18:25:26 +00:00
~Screen.width 2/ =Sprite.x
~Screen.height 2/ =Sprite.y
2021-03-14 01:34:08 +00:00
,default_icn =Sprite.addr
#11 =Sprite.color
#0a =slime
BRK
2021-03-15 00:32:40 +00:00
@FRAME
2021-03-14 01:34:08 +00:00
2021-03-15 00:32:40 +00:00
~Controller.buttons #f0 AND #00 EQU BRK?
2021-03-14 01:34:08 +00:00
#0a =slime
2021-03-15 00:32:40 +00:00
2021-03-14 01:34:08 +00:00
( hold ctrl key to change slime color )
2021-03-15 00:32:40 +00:00
~Controller.buttons #0f AND
2021-03-20 03:38:20 +00:00
DUP #01 NEQ ,$no-ctrl ROT JMP2? #05 =slime $no-ctrl
DUP #02 NEQ ,$no-alt ROT JMP2? #0f =slime $no-alt
2021-03-15 00:32:40 +00:00
POP
( clear ) #10 =Sprite.color
( detect movement )
~Controller.buttons #f0 AND
2021-03-20 03:41:45 +00:00
DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JMP2?
2021-03-16 18:25:26 +00:00
( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up
2021-03-20 03:41:45 +00:00
DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JMP2?
2021-03-16 18:25:26 +00:00
( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down
2021-03-20 03:41:45 +00:00
DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JMP2?
2021-03-16 18:25:26 +00:00
( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left
2021-03-20 03:41:45 +00:00
DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JMP2?
2021-03-16 18:25:26 +00:00
( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right
2021-03-15 00:32:40 +00:00
POP
2021-03-14 01:34:08 +00:00
( draw face )
#11 =Sprite.color
2021-03-15 00:32:40 +00:00
2021-03-14 01:34:08 +00:00
( draw slime )
,slime_icn =Sprite.addr
~slime =Sprite.color
2021-03-15 00:32:40 +00:00
BRK
2021-03-14 01:34:08 +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 ]
|d000 @ERROR BRK
|FF10 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|FF30 ;Controller { buttons 1 }
|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ 0daf 02ff 035f ] ( palette )