origedit<p><span class="h-card" translate="no"><a href="https://merveilles.town/@neauoire" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>neauoire</span></a></span> i would have sent it as a file but it appears my client doesn't allow that.</p><p>( the ball's coordinates have 4 digits after the dot )</p><p>|00 <span class="h-card" translate="no"><a href="https://c.im/@system" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>system</span></a></span> &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1<br>|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1<br>|20 <span class="h-card" translate="no"><a href="https://c.im/@screen" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>screen</span></a></span> &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1<br>|80 @Controller &vector $2 &button $1 &key $1<br>|90 <span class="h-card" translate="no"><a href="https://c.im/@Mouse" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>Mouse</span></a></span> &vector $2 &x $2 &y $2 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1<br>|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1<br>|0008</p><p>@shroom/h</p><p>|0006</p><p>@ball/r</p><p>|0000</p><p> @shroom &x $2 &y $2 &w $2 &speed $2<br> @ball &x $2 &y $2 &vx $2 &vy $2</p><p>|0100</p><p>@on-start ( -> )<br> <a href="https://c.im/tags/11af" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>11af</span></a> .System/r DEO2<br> <a href="https://c.im/tags/61de" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>61de</span></a> .System/g DEO2<br> <a href="https://c.im/tags/904e" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>904e</span></a> .System/b DEO2<br> #0100 .Screen/width DEO2<br> <a href="https://c.im/tags/00c0" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>00c0</span></a> .Screen/height DEO2<br> ;on-frame .Screen/vector DEO2<br> ;on-controller .Controller/vector DEO2<br> init-level BRK</p><p>@on-frame ( -> )<br> control step draw BRK</p><p>@on-controller ( -> )<br> BRK</p><p>@control ( -- )<br> .Controller/button DEI<br> ( left ) DUP #40 NEQ ?{<br> .shroom/x LDZ2k .shroom/speed LDZ2 SUB2 ROT STZ2 }<br> ( right ) #80 NEQ ?{<br> .shroom/x LDZ2k .shroom/speed LDZ2 ADD2 ROT STZ2 }<br> JMP2r</p><p>@init-level ( -- )<br> #0018 .shroom/w STZ2<br> .Screen/width DEI2 .shroom/w LDZ2 SUB2 #01 SFT2 .shroom/x STZ2<br> .Screen/height DEI2 ;shroom/h SUB2 #0010 SUB2 .shroom/y STZ2<br> #0001 .shroom/speed STZ2<br> #0500 .ball/x STZ2<br> #0500 .ball/y STZ2<br> #0010 .ball/vx STZ2<br> #0010 .ball/vy STZ2<br> JMP2r</p><p>@step ( ball )<br> .ball/x LDZ2k .ball/vx LDZ2 ADD2 ROT STZ2<br> .ball/y LDZ2k .ball/vy LDZ2 ADD2 ROT STZ2<br> bounce-shroom bounce<br> ( lose ) .ball/y LDZ2 #04 SFT2 .Screen/height DEI2 LTH2 ?{ lose }<br> JMP2r</p><p>@lose ( -- )<br> [ LIT2 01 -System/state ] DEO<br> JMP2r</p><p>@bounce ( redo this! )<br> .ball/x LDZ2 #04 SFT2 .Screen/width DEI2 LTH2 ?{<br> #0000 .ball/vx LDZ2 SUB2 STH2k .ball/vx STZ2<br> .ball/x LDZ2k STH2r ADD2 ROT STZ2 }<br> JMP2r</p><p>@bounce-shroom ( -- )<br> ( .ball/vy LDZ2 is-negative [ JMP JMP2r ] )<br> ( top ) .ball/y LDZ2 #04 SFT2 ;ball/r ADD2 .shroom/y LDZ2 GTH2 [ JMP JMP2r ]<br> ( ) .ball/x LDZ2 #04 SFT2 .shroom/x LDZ2<br> ( right ) OVR2 OVR2 .shroom/w LDZ2 ADD2 LTH2 ?{ POP2 JMP2r }<br> ( left ) SWP2 ;ball/r ADD2 LTH2 [ JMP JMP2r ]<br> ( bounce ) #0000 .ball/vy LDZ2 SUB2 .ball/vy STZ2<br> ( | why ORA2 doesn't work?? )<br> JMP2r</p><p>@draw ( foreground )<br> #0000 DUP2 .Screen/x DEO2<br> .Screen/y DEO2<br> <a href="https://c.im/tags/c0" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>c0</span></a> .Screen/pixel DEO<br> draw-ball draw-shroom JMP2r</p><p>@draw-ball ( -- )<br> #00 .Screen/auto DEO<br> .ball/x LDZ2 #04 SFT2 .Screen/x DEO2<br> .ball/y LDZ2 #04 SFT2 .Screen/y DEO2<br> ;ball-chr .Screen/addr DEO2<br> <a href="https://c.im/tags/c1" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>c1</span></a> .Screen/sprite DEO<br> JMP2r</p><p>@draw-shroom ( -- )<br> #26 .Screen/auto DEO<br> .shroom/x LDZ2 .Screen/x DEO2<br> .shroom/y LDZ2 .Screen/y DEO2<br> ;shroom-chr .Screen/addr DEO2<br> <a href="https://c.im/tags/c1" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>c1</span></a> .Screen/sprite DEOk DEO<br> JMP2r</p><p>@is-negative ( n* -- f )<br> #8000 AND2<br> ( | POP #00 )<br> NEQ JMP2r</p><p>@ball-chr [<br> 3078 fcfc 7830 0000 3078 fcfc 7830 0000 ]</p><p>@shroom-chr [<br> 0006 0000 0000 0000 3f7f ffff ffff ff7f<br> 00df 0000 0000 0000 ffff ffff ffff ffff<br> 00fc 0c00 0000 0000 fcfe ffff ffff fffe<br> 0000 0001 0301 0000 0000 0001 0301 0000<br> ff00 ff00 91ff eeff 00ff ffff ffff 738c<br> 0000 0080 c080 0000 0000 0080 c080 0000 ]</p>