pieceofcrazy [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=31195 Animation test <p> <table><tr><td> <a href="/bbs/?pid=55453#p"> <img src="/bbs/thumbs/pico55452.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=55453#p"> Animation test - how can i make a resting frame?</a><br><br> by <a href="/bbs/?uid=31195"> pieceofcrazy</a> <br><br><br> <a href="/bbs/?pid=55453#p"> [Click to Play]</a> </td></tr></table> I'm trying some animations, but i can't make the sprite rest. Any suggestions?</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> actor={} actor.x=40 actor.y=30 actor.sprt=0 actor.spd=0.75 function move_d() actor.sprt+=0.125 if actor.sprt&gt;2.9 then actor.sprt=1 end end function move_u() actor.sprt+=0.125 if actor.sprt&gt;18.9 or actor.sprt&lt;17 then actor.sprt=17 end end function move_r() actor.sprt+=0.125 if actor.sprt&gt;4.9 or actor.sprt&lt;3 then actor.sprt=3 end end function move_l() actor.sprt+=0.125 if actor.sprt&gt;20.9 or actor.sprt&lt;19 then actor.sprt=19 end end function _update() if btn(3) then move_d() actor.y+=actor.spd elseif not btn() then actor.sprt=0 end if btn(2) then move_u() actor.y-=actor.spd elseif not btn() then actor.sprt=0 end if btn(1) then move_r() actor.x+=actor.spd elseif not btn() then actor.sprt=0 end if btn(0) then move_l() actor.x-=actor.spd elseif not btn() then actor.sprt=0 end end function _draw() cls() spr(actor.sprt,actor.x,actor.y) end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=31718 https://www.lexaloffle.com/bbs/?tid=31718 Tue, 21 Aug 2018 08:20:58 UTC Ways to select objects by pushing a button? <p>Hi everyone! I know something about coding (very basics stuff) and I'm new to PICO-8.<br /> I'm doing some tests, one of this consist in highlighting an object when the user switch between two objects.<br /> I need some kind of switch, like: when you press 4 the first time highlight X, the second time Y, the following times switch to the other.<br /> This is the code, sorry for bad english:</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> rect1_x1=5 rect1_y1=120 rect1_x2=20 rect1_y2=110 rect2_x1=5 rect2_y1=5 rect2_x2=20 rect2_y2=15 sex1=-1 sey1=-1 sex2=-1 sey2=-1 function _init() cls() end function _update() cls() if btn(4) then sex1=rect2_x1-1 sey1=rect2_y1-1 sex2=rect2_x2+1 sey2=rect2_y2+1 elseif btn(4) then sex1=rect1_x1-1 sey1=rect1_y1-1 sex2=rect1_x2+1 sey2=rect1_y2+1 else end end function _draw() --background----------- rectfill(0,0,127,127,1) --select--------------- rectfill(sex1,sey1, sex2,sey2,10) --1-------------------- rectfill(rect1_x1,rect1_y1, rect1_x2,rect1_y2,8) --2-------------------- rectfill(rect2_x1,rect2_y1, rect2_x2,rect2_y2,8) end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=31688 https://www.lexaloffle.com/bbs/?tid=31688 Thu, 16 Aug 2018 13:07:15 UTC