Thiskul [Lexaloffle Blog Feed] Why dont these values go to zero? <p> <table><tr><td> <a href="/bbs/?pid=119443#p"> <img src="/bbs/thumbs/pico8_jegurokug-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=119443#p"> Demonstration</a><br><br> by <a href="/bbs/?uid=66119"> Thiskul</a> <br><br><br> <a href="/bbs/?pid=119443#p"> [Click to Play]</a> </td></tr></table> </p> <p>Hello, im wondering why the velocity and acceleration (vx and va) dont go to zero when you go left then let go.<br /> Also note that the maximums are different.</p> <p>Controls:<br /> Left -- go left<br /> Right -- go right<br /> X -- force vx and va values to zero</p> <p>is this just a quirk with pico-8?</p> <p>Thanks :)</p> <p>Code:<br /> <div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"></p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function _init() x=0 vx=0 ax=0 end function _update60() if btn(➡️) then ax+=.01 end if btn(⬅️) then ax-=.01 end if btn(❎) then ax=0 vx=0 end vx+=ax x+=vx vx*=.9 ax*=.9 end function _draw() cls() line(x,0,x,127,7) print(vx..&quot; velocity&quot;,0,0,2) print(ax..&quot; acceleration&quot;) print(x..&quot; x&quot;) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p></div></div></div></p> Sat, 22 Oct 2022 05:41:24 UTC