mistermax [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=12978 Keeping a sprite within the x boundaries <p>Pretty basic notion, but I'm falling over on this...<br /> With a sprite that has a starting X,Y and a speed, I'd like the sprite to remain on screen.</p> <p>However:</p> <p>-- locks sprite off screen after passing the screen boundary<br /> -- if btn(0)<br /> --and x&lt;128<br /> -- then//move sprite<br /> -- if x &lt; 128<br /> -- then<br /> -- x=x-speed<br /> -- end<br /> -- end</p> <p>-- locks sprite centre screen<br /> -- while x &lt; 128 do<br /> -- if btn(0) then<br /> -- x=x-speed<br /> -- end<br /> -- end</p> https://www.lexaloffle.com/bbs/?tid=3522 https://www.lexaloffle.com/bbs/?tid=3522 Wed, 01 Jun 2016 06:38:20 UTC