chermosi [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=31388 Make the player jump only when button is pressed from a non pressed state? <p>So in Super Mario and similar games the character only jumps when you press the button, and if you just keep the same button press the character doesn't jump. You have to release the button and then press it again.</p> <p>I've tried to implement a jump action and both with btn and btnp if I keep the button pressed the player keeps jumping forever (in btnp just slower).</p> <p>How can I do this? Thank you! :)</p> https://www.lexaloffle.com/bbs/?tid=33724 https://www.lexaloffle.com/bbs/?tid=33724 Mon, 25 Mar 2019 15:02:06 UTC How to make a monster/npc patrol? <p>I can't seem to find any tutorials on how to make monsters move or patrol or have movements routines.</p> <p>Nothing fancy, something like:</p> <p>Go from A to B, wait a few frames, go to C, wait again, go back to A and repeat.</p> <p>The monster doesn't even have to notice the player, just walk its path.</p> <p>I've tried with loops but I can't make it work.</p> <p>Thank you very much!!! :D</p> https://www.lexaloffle.com/bbs/?tid=33323 https://www.lexaloffle.com/bbs/?tid=33323 Tue, 19 Feb 2019 13:42:27 UTC Easiest way to draw a circle without using the circ funcion? <p>I'm trying some math things to learn pico8 and programming in general.</p> <p>After a few days and realizing that the square root in lua (and in every language?) only gives positive numbers, I&rsquo;ve come to this monster to draw a simple circle haha</p> <div> <div style="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() end function _update60() cls(1) end function _draw() --coordinates line(64,0,64,128,2) line(0,64,128,64,2) manual_circle() circ(64,64,63) end function manual_circle() for x=0,50 do radius=50 local y=-sqrt((radius^2)-(x^2)) pset(x+64,y+64,11) end for x=-50,0 do radius=50 local y=-sqrt((radius^2)-(x^2)) pset(x+64,y+64,11) end for x=0,50 do radius=50 local y=-sqrt((radius^2)-(x^2)) pset(x+64,-y+64,11) end for x=-50,0 do radius=50 local y=-sqrt((radius^2)-(x^2)) pset(x+64,-y+64,11) end 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>And it looks like this:</p> <img style="" border=0 src="https://www.lexaloffle.com/bbs/files/31388/circ.jpg" alt="" /> <p>as you can see the function doesn't print the pixels continuosly as the circ function, probably because of the square root giving decimals.</p> <p>What is the correct way of drawing a circle &ldquo;manually&rdquo;???</p> <p>Thank you!</p> https://www.lexaloffle.com/bbs/?tid=33236 https://www.lexaloffle.com/bbs/?tid=33236 Mon, 11 Feb 2019 13:57:29 UTC Horizontal collisions <p>I'm learning to make hitbox collisions (instead of flags collisions).<br /> Vertical collisions seem to work just fine but horizontals don't.<br /> How can this be done?<br /> Maybe hitbox collisions are just to complicated and shouldn't be used?<br /> .<br /> .<br /> .<br /> <table><tr><td> <a href="/bbs/?pid=61033#p"> <img src="/bbs/thumbs/pico8_hermo-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=61033#p"> hermo</a><br><br> by <a href="/bbs/?uid=31388"> chermosi</a> <br><br><br> <a href="/bbs/?pid=61033#p"> [Click to Play]</a> </td></tr></table> <br /> .<br /> .<br /> .</p> <div> <div style="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() pad_x=45 pad_y=45 pad_width=30 pad_height=30 pad_color=7 pad_speed=3 ball_x=80 ball_y=10 ball_radius=4 ball_color=8 ball_speed_x=2 ball_speed_y=2 end function _update60() btnprss=false cls(1) --ball movement ball_x+=ball_speed_x ball_y+=ball_speed_y --ball-screen collision if ball_x&lt;0 or ball_x&gt;128 then ball_speed_x=-ball_speed_x end if ball_y&lt;0 or ball_y&gt;128 then ball_speed_y=-ball_speed_y end --pad movement if btn(0) then btnprss=true pad_speed=-5 end if btn(1) then btnprss=true pad_speed=5 end pad_x+=pad_speed if btnprss==false then pad_speed=pad_speed/2 end if pad_x&lt;1 or pad_x&gt;126-pad_width then pad_x=mid(1,pad_x,126-pad_width) end pad_color=7 if ball_box(pad_x,pad_y,pad_width,pad_height) then pad_color=8 ball_speed_y=-ball_speed_y end end function _draw() rectfill(pad_x,pad_y,pad_x+pad_width,pad_y+pad_height,pad_color) circfill(ball_x,ball_y,ball_radius,ball_color) end function ball_box(box_x,box_y,box_w,box_h) --conditions where there are no collisions if ball_y-ball_radius&gt;box_y+box_h then return false end if ball_y+ball_radius&lt;box_y then return false end if ball_x-ball_radius&gt;box_x+box_w then return false end if ball_x+ball_radius&lt;box_x then return false end return true 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=32962 https://www.lexaloffle.com/bbs/?tid=32962 Sun, 20 Jan 2019 17:33:25 UTC Change vertex of a triangle pushing a button <p>Hello!</p> <p>I'm learning Pico8 and programming in general, so I'm trying some very very simple things.</p> <p>I've made a triangle using lines, and using the arrow keys I can move one of the vertices of the triangle.<br /> How can I make it so if I push button5 the arrow keys stop moving that vertex and start moving the second one, press again and changes to the third one and finally press again and changes to the first.</p> <p>Thank you so much!</p> <p>So far this is the code I have:</p> <div> <div style="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() x1=100 y1=20 x2=40 y2=40 x3=60 y3=60 c=7 end function _update60() cls(1) if btn(0) then x1-=1 end if btn(1) then x1+=1 end if btn(2) then y1-=1 end if btn(3) then y1+=1 end end function _draw() line(x1,y1,x2,y2,c) line(x2,y2,x3,y3,c) line(x3,y3,x1,y1,c) 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=32384 https://www.lexaloffle.com/bbs/?tid=32384 Fri, 30 Nov 2018 07:20:42 UTC How to flip a sprite? <p>I've read somewhere that you can show a flipped sprite using TRUE like in spr(1,x,y,TRUE) but it doesn't seem to work for me.</p> <p>Is it possible? what i'm i doing wrong?</p> <p>thank you!!! :)</p> https://www.lexaloffle.com/bbs/?tid=31913 https://www.lexaloffle.com/bbs/?tid=31913 Thu, 20 Sep 2018 10:09:15 UTC gitches when editing with external editor? <p>Hello!!!</p> <p>I'm starting with PICO-8 and loving it!</p> <p>I�m new to programming and the only thing that I don't like that much is the code editor. The font its pretty hard to read and the horizontal scrolling with so few characters makes it difficult to find errors.</p> <p>I've read that you can just open the .p8 file and edit them with a text editor and looks like it works just fine but at the end of the file there are some weird big block of characters. Is this expected? If I edit a file with a text editor (lets say Notepad++) I just edit my code and ignore the block of weird characters???</p> <p>Thank you!!! :D</p> https://www.lexaloffle.com/bbs/?tid=31803 https://www.lexaloffle.com/bbs/?tid=31803 Mon, 03 Sep 2018 03:43:11 UTC