oehqoehfo [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=28667 how to check if dset with specific index returns nothing? <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> for i=0,i&lt;10,1 do if dset(i, variable) exists dset(i+1,variable); elseif dset(i,variable) doesnt exist dset(i,variable); 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>I want to do something like the code above.</p> <p>I know the code isn't right (somehow user must break the for loop)but it's just an idea.<br /> but I don't know if it is possible to do so.</p> <p>scores should be saved everytime user finishes the game but to implement that feature, I should check if previous value in dset returns something.</p> <p>If user finished game 10 times, 10 scores should be saved </p> https://www.lexaloffle.com/bbs/?tid=31224 https://www.lexaloffle.com/bbs/?tid=31224 Thu, 03 May 2018 08:28:04 UTC pico8 get collision between character and empty sprite on the map <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/28667/pico8.png" width=1003 height=1000 alt="" /> <p>the image is map of my game.</p> <p>pink rectangles are empty sprite on the map.</p> <p>If game characters enters the location of these empty sprites, some events should happen.</p> <p>I asked similar question some days ago, a person said me to use mget method.</p> <p><a href="https://www.lexaloffle.com/bbs/?pid=51536#p51536">https://www.lexaloffle.com/bbs/?pid=51536#p51536</a></p> <p>I thought I should compare player's x coordinate and y coordinate to coordinates of sprite. I tried some days but nothing helped.</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> p={ x= --x coordinate of player y= --y coordinate of player } </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>p.x and p.y are coordinates of player. I can't change that because my code has 600~700 lines..</p> <p>could someone help me with simple examples or description? </p> https://www.lexaloffle.com/bbs/?tid=31202 https://www.lexaloffle.com/bbs/?tid=31202 Sun, 29 Apr 2018 08:58:01 UTC How to run rectFill just once in second?? <p>Well It's really annoying to me<br /> Fxxxxxx annoying</p> <p>I am currently making a HP bar which decreases when user and monster collide</p> <p>I have been trying to solve problem more than 5 hours but nothing worked.</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> enemies={} enemyAttackdelay = 1; function _draw() --[[codes]] hpstatus(0); end function enemies.move(e) end function hpstatus() 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=31119 https://www.lexaloffle.com/bbs/?tid=31119 Fri, 13 Apr 2018 09:26:39 UTC How to detect obstacles in game map? <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/28667/ninja.png" width=911 height=868 alt="" /> <p>I am creating smart monsters which can detect obstacles. Objects in yellow circles are obstacles. Red circles are where they can jump </p> <p>Ignore two yellow circles on both left and right sides of the map<br /> When user is in higher place than monster, monster should find place which they can jump. If monsters are under obstacles, they should not jump. </p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/28667/ninja2.png" width=950 height=820 alt="" /> <p>These obstacles(floors) are drawn so.</p> <p>Unfortunately, I don't know how to do that. I know how to detect enemies' position but not position of obstacles.</p> <p>I am not asking do that for me. I am just wondering what should and what can I do!</p> <p>Any help, advice, tip will be grateful! </p> https://www.lexaloffle.com/bbs/?tid=31114 https://www.lexaloffle.com/bbs/?tid=31114 Thu, 12 Apr 2018 05:03:12 UTC Any cool free music which I can use? <p>Hi</p> <p>I am making a ninja game now.</p> <p>I need a really cool background music. I tried to use music editor with PICO-8 but I don't I have any sense of creating </p> <p>a cool music. Creating a music was really simple, but create a good or cool music is a different thing which requires </p> <p>talent of creating music which is totally unrelated with coding.</p> <p>That's why I am looking for a cool music which is allowed to use free.</p> <p>I tried to google &quot;pico-8 free music&quot; &quot;free song pico-8&quot; but found nothing.</p> https://www.lexaloffle.com/bbs/?tid=31086 https://www.lexaloffle.com/bbs/?tid=31086 Thu, 05 Apr 2018 04:30:55 UTC remove or hide text which is made with print() method? <p>Well I am new to lua and pico-8</p> <p>In javascript, it is possible to force run inner function after some seconds with setTimeout();</p> <p>setTimeout(function(){},5000);</p> <p>and I am looking for something similar method or function in lua or pico-8</p> <p>this is my code</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 define_level() local level = 'level'..levels; show_level(level); end function show_level(level) print(level,54,64,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> <p>levels is number. </p> <p>I want to hide or remove text which is printed with print(level, 54,64,8);<br /> after some seconds.</p> <p>Any tips? </p> https://www.lexaloffle.com/bbs/?tid=30987 https://www.lexaloffle.com/bbs/?tid=30987 Fri, 23 Mar 2018 08:23:27 UTC Attempt to index global 'function name' (a nil value)? <p>Hello I started lua programming just yesterday.</p> <p>Because my project should be started right now, I hadn't so much time to read through lua tutorials.</p> <p>I am an web developer and I have never seen such errors when I worked with Javascript and Java and I don't understand meaning of the error.</p> <p>This is my code</p> <p>The error is occured in function drawLife.draw()</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 _draw() cls(); rectfill(0,0,128,128,12); rectfill(0,72,128,128,7); clouds.draw(); mapdraw(16,16); mapdraw(0,0); enemies.draw(); bullets.draw(); p.draw(); mapdraw(16,0); fires.draw(); score.draw(); drawLife.draw(); print(bullets.type,4,4,7); end function drawLife.draw() rectfill(80,80,60,60,#FF004D); rectfill(80,80,60,60,#FF004D); rectfill(80,80,60,60,#FF004D); rectfill(80,80,60,60,#FF004D); rectfill(80,80,60,60,#FF004D); 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>I added .draw() after drawLife because I got lua code from my friend's brother who is game developer... and there were many .draw() and :draw() after the function name.. I need to learn about that </p> https://www.lexaloffle.com/bbs/?tid=30983 https://www.lexaloffle.com/bbs/?tid=30983 Thu, 22 Mar 2018 05:12:49 UTC