camp39 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=92361 sound effect during animation <p>little help?<br /> A sprite shakes if a certain condition is met and function called. I'd like to play a sound effect while it shakes. But I cant seem to make it play the whole sound effect because it starts over with each update and buzzes rather than plays. I can get the sound effect, or I can get the animation, but cant seem to make them both happen at the same time.<br /> I've tried many different variations and schemes, but here is one example:</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() correct = nil tics = 30 end function _update() if (correct == false) shake() end function _draw() draw_stuff() end function shake() sfx(0) tics -= 1 if tics &gt; 0 then mysprite.x = mysprite.x + cos(t()/.1) --makes it shake back and forth else correct = nil tics = 30 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 can see <em>why</em> it doesn't work; because it is calling the <code>sfx(0)</code> again and starting over every time <code>shake()</code> is called. But what is the right way of thinking about playing the sound along with an animation? I read about coroutines, but am not sure if that is actually needed for something this basic. I'd also like to just be able to call the function whenever I want and not bother checking in <code>_update()</code> every frame.<br /> I'll be grateful for any good example, tips, explanation or pointing in the right direction. Thank you.</p> https://www.lexaloffle.com/bbs/?tid=143144 https://www.lexaloffle.com/bbs/?tid=143144 Sun, 14 Jul 2024 08:15:46 UTC Variations: The Stafford Gambit <p> <table><tr><td> <a href="/bbs/?pid=150338#p"> <img src="/bbs/thumbs/pico8_stafford_gambit-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=150338#p"> Variations: The Stafford Gambit</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=150338#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Variations: The Stafford Gambit</h1> <h3>Credits</h3> <ul> <li> <p>These variations come from the <a href="https://www.youtube.com/watch?v=nH_fiqlLp2U&amp;amp;list=PLdT3OotRiHJlIZw05EqVXpdn3M8qB7AJZ&amp;amp;index=1">Eric Rosen</a> youtube channel.<br /> (watch the link while practicing with this cart for maximum understanding)</p> </li> <li>Big thank you to <a href="https://www.lexaloffle.com/bbs/?uid=66501"> @Heracleum</a> for kindly going through one of my previous variation carts and teaching me how to properly make a data table. Its made more variations possible.</li> </ul> <h3>About</h3> <p>The Stafford Gambit is an objectively bad opening for black. But white has to play accurately which is very hard to do, giving lots of attacking chances, pins, traps, and nasty mates. Natural moves for white lead to certain doom. If you learn these 20 variations inside and out you will confuse many opponents and have a blast doing it. If your opponent really knows what they are doing, you may be in serious trouble!</p> <h3>Features</h3> <ul> <li>starting position is on move 3.Nxe5 for less repetition</li> <li>computer moves faster than previous, painfully slow variation carts</li> <li>hint button</li> <li>random variation selection</li> <li>menu navigation</li> <li>stockfish evaluation at end of each variation</li> </ul> <h3>Controls</h3> <p>❎ select/de-select piece and move-to square<br /> 🅾️ hold down during black's move to show a hint</p> https://www.lexaloffle.com/bbs/?tid=142834 https://www.lexaloffle.com/bbs/?tid=142834 Mon, 24 Jun 2024 06:20:34 UTC Variations: The Vienna <p> <table><tr><td> <a href="/bbs/?pid=148751#p"> <img src="/bbs/thumbs/pico8_variations_vienna-4.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=148751#p"> Variations: The Vienna</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=148751#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Variations: The Vienna</h1> <h3>Description</h3> <p>16 variations of the Vienna opening played as white. These lines are chosen to be fun, for their attacking chances and dynamic play. They include common mistakes by black and how to punish them as well as how to respond to good play from your opponent. Practicing with this cartridge will give any player a good start to creating big problems for black with the Vienna!</p> <h3>Features</h3> <p>While none of white's moves are dubious, they are not necessarily the top engine recommendations. Because there is no 'right' move, a hint can be requested (see <em>Controls</em>). After completing a variation, the Stockfish evaluation is given. The player then has the options to either repeat the completed variation, move on to the next, or have the computer select a variation at random. The pause menu gives similar options but can be accessed at any time allowing the player to navigate to a specific variation or move to a new, random variation.</p> <h3>Controls</h3> <p>❎ select/de-select piece and move-to square<br /> 🅾️ hold down during white's move to show a hint</p> https://www.lexaloffle.com/bbs/?tid=142371 https://www.lexaloffle.com/bbs/?tid=142371 Tue, 21 May 2024 02:25:47 UTC table behaviour in lua/pico <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>a = {x=10, y=25} b = a b.x = 99 print(a.x)</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>This prints <code>99</code> but I assumed it would print <code>10</code>.<br /> I wrote code with a start table. Then I set a position table equal to the start table. I was hoping to update the position table but reset the position back to the start point at any time I wanted. I tested this out in php to make sure I wasn't crazy and it worked like I expected. I tried it out in strict Lua but it gave the result above. Why does Lua change the <code>a</code> table when I only changed the <code>b</code>? How do I deal with this?</p> https://www.lexaloffle.com/bbs/?tid=142102 https://www.lexaloffle.com/bbs/?tid=142102 Fri, 03 May 2024 23:49:34 UTC export sprite sheet <p>In pico-8, when I want to reuse a sprite sheet for a new cart, I would just<br /> copy/paste all the gfx and map data at the end of the file. It's not so simple<br /> in Picotron.</p> <p>How do I start a new cart in Picotron with an existing sprite sheet and map?</p> https://www.lexaloffle.com/bbs/?tid=142016 https://www.lexaloffle.com/bbs/?tid=142016 Mon, 29 Apr 2024 02:42:49 UTC Mate in 2 -- Volume 2 <p>Mate-in-2 Volume 2. 33 more puzzles. White to move. <table><tr><td> <a href="/bbs/?pid=147158#p"> <img src="/bbs/thumbs/pico8_matein2vol2-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=147158#p"> matein2vol2</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=147158#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=141898 https://www.lexaloffle.com/bbs/?tid=141898 Mon, 22 Apr 2024 23:58:04 UTC Mate In 2 -- Vol.1 <p> <table><tr><td> <a href="/bbs/?pid=144867#p"> <img src="/bbs/thumbs/pico8_matein2volume1-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=144867#p"> matein2volume1</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=144867#p"> [Click to Play]</a> </td></tr></table> </p> <p>33 mate-in-2 puzzles. White to move. Will release more volumes.</p> https://www.lexaloffle.com/bbs/?tid=141199 https://www.lexaloffle.com/bbs/?tid=141199 Thu, 28 Mar 2024 16:50:37 UTC