camp39 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=92361 trouble moving sprite, atan2() <p>Moving game pieces using atan2().<br /> I check to see if the position (px,py)<br /> has reached the target (tx,ty) by<br /> absolute values of positions minus targets.<br /> If they havent reached the destination I increment<br /> by the dx I got from the atan2() calculation.</p> <p>This works as it is. But I cannot actually control the speed.<br /> If I want it to go faster, say speed 8, there are certain<br /> situations where condition <code>if abs(px-tx)&lt;3 and abs(py-ty)&lt;3</code> will never<br /> be met and piece will just go forever. And I cant fine tune the <code>&lt;3</code> either<br /> because sometimes the math just wont allow it.</p> <p>How do I write code or think about this to move my sprite so I can actually control<br /> the speed and/or accuracy?<br /> Must be able to move any direction at any angle.<br /> Thank you.</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>speed=5 px,py=getxy(location) tx,ty=getxy(destination) local angle=atan2(ty-py,tx-px) dx=sin(angle)*speed dy=cos(angle)*speed --PROBLEM HERE function _update_move() if abs(px-tx)&lt;3 and abs(py-ty)&lt;3 then --AND PROBLEM HERE --ARRIVED AT LOCATION else px+=dx py+=dy 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> https://www.lexaloffle.com/bbs/?tid=148204 https://www.lexaloffle.com/bbs/?tid=148204 Thu, 03 Apr 2025 03:59:17 UTC config files? <p>Are there config files for the editors?<br /> So if I wanted to say, change the tab size or key-bindings in the code-editor.</p> <p>if not, does anyone know where I could start poking around?</p> <p>update: i did find /system/apps/code.p64 which looks promising. any other info is welcome</p> https://www.lexaloffle.com/bbs/?tid=147969 https://www.lexaloffle.com/bbs/?tid=147969 Sat, 22 Mar 2025 02:10:04 UTC YinYang <p> <table><tr><td> <a href="/bbs/?pid=164157#p"> <img src="/bbs/thumbs/pico8_yinyang1-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=164157#p"> YinYang</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=164157#p"> [Click to Play]</a> </td></tr></table> </p> <h3>YinYang</h3> <ul> <li>30 yinyang puzzles</li> </ul> <h3>Rules</h3> <ul> <li>all spaces be filled</li> <li>some spaces are pinned with balls that cannot be changed</li> <li>all dark balls connected orthogonally in single group</li> <li>all light balls connected orthogonally in single group</li> <li>no 2x2 group of the same color allowed</li> </ul> https://www.lexaloffle.com/bbs/?tid=147952 https://www.lexaloffle.com/bbs/?tid=147952 Fri, 21 Mar 2025 07:48:00 UTC Solitaire Chess -- Vol. 2 <p> <table><tr><td> <a href="/bbs/?pid=163875#p"> <img src="/bbs/thumbs/pico8_solitaire_chess_v2-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=163875#p"> Solitaire Chess -- Vol. 2</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=163875#p"> [Click to Play]</a> </td></tr></table> </p> <p>If you find a puzzle you think is impossible, let me know in the comments. enjoy!</p> <h3>Solitaire Chess -- Vol. 2</h3> <p>-400 solitaire chess puzzles<br /> -50 puzzles each from 4 to 11 pieces<br /> -navigation map and autosave</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/92361/solitairev2_0.gif" alt="" /> https://www.lexaloffle.com/bbs/?tid=147863 https://www.lexaloffle.com/bbs/?tid=147863 Sun, 16 Mar 2025 07:30:04 UTC Piconissimo v1.5 <p> <table><tr><td> <a href="/bbs/?pid=163138#p"> <img src="/bbs/thumbs/pico8_piconissimo_v1-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=163138#p"> Piconissimo v1.5</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=163138#p"> [Click to Play]</a> </td></tr></table> </p> <h3>Piconissimo v1.5</h3> <p>Sound editor</p> <h3>Version 1.5 Additions</h3> <ul> <li> <p>copy/paste<br /> (Z=copy,X=paste)</p> </li> <li>horizontal pattern scroll<br /> (click right/left icons on either side of note display.)</li> </ul> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/92361/piconissimo p8_0.png" alt="" /> <h3>Getting started</h3> <ul> <li>click garbage icon at top right for fresh start. This will permanently erase everything...Including theme music :(</li> <li>all numbers can be right/left clicked</li> <li>rightclick a piano key to test, leftclick to insert note into selected sfx</li> <li>red 'stop sign' stops anything playing</li> <li>unmute dark blue sfx in patterns by clicking on dot</li> <li>click blue floppy icon to save. save often.</li> <li>see manual for detailed info</li> </ul> <h3>Manual</h3> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"></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>--[[ Piconissimo v1.0 2025 by camp39 Uses mouse and keyboard. --Piconissimo has a full PICO-8 keyboard GUI.-- SET KEYBOARD VALUES: right/left click on pink/blue/gray to right of keyboard PLAY NOTE: rightclick on keyboard SET SPEED: right/left click on top red number --only selected track/sfx speed displayed SET JUMP: right/left click on green number --when a note is set, if there is room, the cursor will &quot;jump&quot; this many slots forward in the sfx TOGGLE BARS: press X btn while on gray dots above tracks --will turn on/off bar displays --useful as a visual aid for timing SELECT NOTE: Arrow keys to move square cursor to track/sfx/position COPY/PASTE: Z to copy. X to paste. NOTE DISPLAY: Selected note displays beneath tracks SET NOTE: leftclick on keyboard (track/sfx must be selected) --overwrites any selected note SET TRACK: right/left click on lefthand track numbers to desired sfx PLAY SINGLE SFX: select track, click right hand play icon (red triangle) ERASE SINGLE SFX: select track, click righthand &quot;x&quot; icon PLAY SELECTED NOTE: Click pink triangle right of note display ERASE SELECTED NOTE: Click gray &quot;X&quot; icon left of note display. Or copy (Z BTN) and paste (X BTN) a blank space. ADJUST SELECTED NOTE: Right/left click note display values SAVE WORK: leftclick blue floppy disk icon in top right corner --cntrl-s does NOT save your music! --save often --Rebooting, pressing ESC or CNTRL-R will lose any unsaved work ERASE ALL: leftclick garbage can icon --all channels set to sfx(0) --all channels set to mute, no loop or stop flags. --all sfx notes set to C0 000 (note,ins,vol,eff) --all saved work will be lost --do this first thing to erase theme music PLAY CURRENT TRACKS: left click 4-shafted, red triangle icon on right of screen. --this plays current track sfxs regardless of whether they are in a pattern channel or not. STOP ALL: Click red &quot;stop sign&quot; icon. Stops anything currently playing. --Piconissimo displays up to 5 patterns at once-- SELECT PATTERNS: Right/left click on pink pattern numbers. SET CHANNELS: Right/left click on 4 sfx numbers beneath pattern number. --displays red if sfx is currently selected in tracks PATTERN TO TRACKS: click &quot;up arrow&quot; icon to right of pattern number --this changes each track to the sfx in each channel of pattern MUTE SFX: leftclick dot to left of sfx to toggle. Displays dark blue if muted. LOOPS AND STOPS: same as built-in editor PLAY PATTERN: Click triangle icon under pattern. --Current playing pattern displayed in bright yellow next to JUMP value. ]] </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p></div></div></div></p> <h3>Credits</h3> <p><a href="https://www.lexaloffle.com/bbs/?tid=2341">This thread</a> started by <a href="https://www.lexaloffle.com/bbs/?uid=10210"> @eruonna</a> 10 years ago was ...instrumental... in making this cart. And <a href="https://www.lexaloffle.com/bbs/?uid=69199"> @PennDraken</a>'s more recent contributions as well. Its a good thread, you should check it out.</p> https://www.lexaloffle.com/bbs/?tid=147631 https://www.lexaloffle.com/bbs/?tid=147631 Mon, 03 Mar 2025 04:11:00 UTC 100 Headaches (Mate in 2 -- vol. 4) <p> <table><tr><td> <a href="/bbs/?pid=162652#p"> <img src="/bbs/thumbs/pico8_headache100-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=162652#p"> 100 Headaches (mate-in-2 vol.4)</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=162652#p"> [Click to Play]</a> </td></tr></table> </p> <h3>100 Headaches</h3> <p>100 extremely difficult mate in 2 chess puzzles.<br /> Based on the book <em>100 Headachingly Hard Mate In Two Chess Puzzles by Sam Loyd</em> by Martin B. Justesen.</p> <h3>Gameplay</h3> <p>It is white to move on every puzzle. But the player ALSO makes black's move rather than a computer-automated response. That way, you can try out different moves for black to prove to yourself that it is, indeed, mate in 2.</p> <h3>Scoring</h3> <p>Plus 5 for every correct move. Minus 1 for every wrong move. Only on unsolved puzzles. Once a puzzle is completed, you can replay it as many times as you like and not lose/gain points.</p> <h3>Navigation</h3> <p>All progress is automatically saved. There is a handy 'map' of all 100 puzzles and you are free to jump to any number you like.</p> <p>I do not expect anyone to finish this. Let alone with a positive score. But if there is a true masochist out there, please share a screenshot!</p> <p>Thanks to <a href="https://www.lexaloffle.com/bbs/?uid=2185"> @phil</a> for helpful feedback on my last cart. It made this cart better.</p> https://www.lexaloffle.com/bbs/?tid=147467 https://www.lexaloffle.com/bbs/?tid=147467 Sat, 22 Feb 2025 02:56:47 UTC mate in 1-2-3 <p> <table><tr><td> <a href="/bbs/?pid=161058#p"> <img src="/bbs/thumbs/pico8_mate123v1-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=161058#p"> mate in 1-2-3 vol. 1</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=161058#p"> [Click to Play]</a> </td></tr></table> </p> <h3>Mate in 1-2-3 vol.1</h3> <p>each level is a mate in 1, a mate in 2, and a mate in 3.<br /> 50 levels for a total of 150 puzzles.</p> <p>progress saves with each puzzle.</p> <h3>about the puzzles and the code</h3> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> These puzzles were collected from the lichess api. This is easier than manually pulling them from books, but unfortunately lichess only provides the pgn, not the fen. So there is still a tedious step. But I should be able to make more chess puzzlers a lot faster than before. <a href="https://www.lexaloffle.com/bbs/?uid=112843"> @toadofsky</a> had talked about getting live lichess puzzle updates and playing in real time. I'm not sure if that is possible, and I see my carts as useful to people with handhelds and no internet. However, the lichess api idea was a good one and so I'm grateful for his suggestion.</p> <p>The only problem is that lichess rates it's puzzles by the ratings of people that play. So if a strong player screws up on a puzzle, it's rating goes up... It makes sense but the puzzle strengths don't seem consistent. I called 10 puzzles for each of the five difficulty settings, easiest to hardest. But honestly they all seem too easy. That is the good thing about getting puzzles from books, because those are designed to be tricky and are explicitly puzzles instead of real games.</p> <p>I finally have move generation and so I think the interface is much more pleasant than any of my previous mate in 2 games. But I still really want some kind of animation when the pieces move.<br /> </div></div></div></p> https://www.lexaloffle.com/bbs/?tid=146745 https://www.lexaloffle.com/bbs/?tid=146745 Fri, 24 Jan 2025 06:10:49 UTC NICE 1.0 Freestyle Chess <p> <table><tr><td> <a href="/bbs/?pid=159904#p"> <img src="/bbs/thumbs/pico8_nicev1freestyle-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=159904#p"> NICE 1.0 Freestyle Chess</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=159904#p"> [Click to Play]</a> </td></tr></table> <br /> Freestyle Chess == Chess960 == Fischer Random</p> <h2>NICE: Nice Is Camp39's Engine</h2> <h3>The Good</h3> <ul> <li>pass n play and board flip option</li> <li>clean interface &amp; themes</li> <li>play against computer</li> <li>opening book for standard chess</li> <li>endless openings with Freestyle Chess (press up while on chess960 to view positions)</li> <li>all rules, including 50 move and 3-fold repetition</li> </ul> <h3>The Bad</h3> <ul> <li>my first engine ever... its a little slow</li> <li>my first engine ever... its a little dumb</li> <li>maybe 2.0 will be better!</li> </ul> <h3>About NICE</h3> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> This was a real accomplishment for me and is my first engine. The move generation follows the tutorial of Bluefever Software video series on Youtube: <a href="https://www.youtube.com/watch?v=2eA0bD3wV3Q&amp;list=PLZ1QII7yudbe4gz2gh9BCI6VDA-xafLog">Programming a Chess Engine in Pure Javascript</a>. </p> <p>When it came to the search functions I learned a ton by following the book: <em>Chess Algorithms</em> by Noah Caplinger.</p> <p>The limitations of Pico-8 though make for a challenging adaptation of these types of tutorials. (translating from zero-based arrays can give some crazy nasty bugs). The speed limitations make some variation strategies useless e.g. &quot;killer moves&quot; only make sense with a depth of at least 4. It was a really cool experience and gave me more insight into the game.</p> <p>I liked the board layout from cart #quickchessyness-4 by <a href="https://www.lexaloffle.com/bbs/?uid=68584"> @Adam_Howell</a> so much that I copied it :)</p> <p>This cart will need some updates however. I was unable to get quiesence to work without a move taking FOREVER. Maybe due to my move ordering, maybe due to the evaluation function, maybe due to lots of things. Its all very complicated and hurts my brain since it is recursive at iterative depths. Hard to pinpoint problems like that. If any kind soul wants to offer tips, I'm all ears!</p> <p><a href="https://www.lexaloffle.com/bbs/?uid=16423"> @Krystman</a> of course released the fabulous Pico Checkmate, cart #54038 6 years ago. I definitely looked through his code for clues but couldn't manage to find a way to cut off a search if time got too long. But I did follow his lead and purge illegal moves right off the bat instead of making and taking them. Without a full quiesence search though, I don't think NICE will stand a chance against Pico Checkmate.</p> <p>This cart, while not having the best engine still has some nice features. Chess960 is chess but with almost random starting positions. Its just like standard chess with the exception that castling can be a little weird. Just remember that king and rook end up in the same ending positions as in regular chess, regardless of where they started. Otherwise, same rules apply. This eliminates the same opening every time you play against the computer. Also, to prevent that from happening in standard chess, I coded in a small opening book with response options being chosen randomly so that you can get different responses even if you play the same.</p> <p>I hope this cart is popular with hand-held users (I don't personally own one). The pass n play is not something I've seen on other chess carts and I imagine a game of chess on a long flight or bus ride would be cool, but playing upside down is a bit awkward.</p> <p>Crazy idea: what if there was a cart with the move generation and graphics already on it (and optimized to the max) and then two different users could put in a tiny engine each and let them battle. Maybe more realistic on picotron?</p> <p></div></div></div></p> https://www.lexaloffle.com/bbs/?tid=146322 https://www.lexaloffle.com/bbs/?tid=146322 Sat, 28 Dec 2024 06:52:41 UTC numbers equivalence <p>how do i test for big numbers that print different than their true value?</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() srand(39) a=rnd(-1) --prints -20954.2428 b=-20954.2428 end function draw() if b==a then ?&quot;true&quot; else ?&quot;false&quot; end --prints false 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 have some big numbers that would be nice to know their true value.<br /> thanks and merry Christmas!</p> https://www.lexaloffle.com/bbs/?tid=146284 https://www.lexaloffle.com/bbs/?tid=146284 Wed, 25 Dec 2024 04:04:35 UTC coroutines? <p>When the AI plays itself in my game, it is too much for the _update() so PICO-8 drops _draw() frames. The moves are correct, but its awkward because both pieces move at once.</p> <p>How do I remedy this? Is it a coroutine I need? I've been playing with them and have gotten some crazy results, not really knowing what I am trying to accomplish. But is that even the right approach? </p> <p>Or can I make some kind of delay between moves to give the cpu time to catch up? I tested by making it only run the engine after a button press and it works fine.</p> <p>I also tried calling flip() explicitly after the resource-heavy function but no dice.</p> <p>any pointers are appreciated.</p> https://www.lexaloffle.com/bbs/?tid=145801 https://www.lexaloffle.com/bbs/?tid=145801 Sat, 30 Nov 2024 09:05:13 UTC lichess api <p><a href="https://www.lexaloffle.com/bbs/?uid=112843"> @toadofsky</a><br /> I moved the conversation to chat so as not to clog up the cartridge section. </p> <p>in response to your last post;<br /> how are you going to hook up PICO-8 to the internet though? Can you do that?</p> https://www.lexaloffle.com/bbs/?tid=145789 https://www.lexaloffle.com/bbs/?tid=145789 Fri, 29 Nov 2024 06:54:04 UTC PICO in Nano <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/92361/piconano.png" alt="" /> <p>made external editor feel more like pico...does anyone else do this too?</p> https://www.lexaloffle.com/bbs/?tid=144950 https://www.lexaloffle.com/bbs/?tid=144950 Sun, 27 Oct 2024 00:03:26 UTC string to assoc array <p>I'd like to make some associative tables e.g. <code>table={x=7,y=90,z=40}</code><br /> but I want to save tokens by using a string because I'm going to have a lot of them, and make a function that returns a table based on whatever is in the string.</p> <p>So something like:</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>string1=&quot;x=7,y=90,z=40&quot; string2=&quot;empty=100, dinner=casserole, transport=horse, weight=150&quot; table1=assoc_table(string1) table2=assoc_table(string2) ?table1.z -- 40 ?table2.transport -- horse</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>how do I go about this? <code>split</code> wont work. what does my <code>function assoc_table(str)</code> look like? </p> https://www.lexaloffle.com/bbs/?tid=144886 https://www.lexaloffle.com/bbs/?tid=144886 Wed, 23 Oct 2024 04:36:07 UTC hide_mouse_cursor bug <p>v0.2.6b<br /> The hide_mouse_cursor feature is very buggy. That is the option that makes the mouse cursor disappear while typing in the PICO-8 editor. Length in seconds can be configured in config.txt but the problem is there even with the default of 5 sec. </p> <p>On startup it works but after a while of coding it stops working at all. I posted this before but deleted my post because the steps I gave to reproduce didn't always make it happen. So it's hard for me to say exactly when it stops working. But I think that everyone here will notice if they pay attention, that after a some time working on a game, the mouse cursor will remain in the way while typing.</p> <p>If you <code>ctrl-r</code> <code>ctrl-r</code> it will start working again. But if you type something at the command prompt and say, get a syntax error, or even just <code>ls</code> to show whats in the directory, or <code>cls()</code>, most of the time (but not always!) when you esc back to the editor it will be broken and the mouse will show even while you are typing. This will persist for the rest of the session. <code>ctrl-r</code> TWICE seems to reset it, but once is not enough.</p> <p>I know this is a small thing, but once you notice it, its sort of annoying because of how nice it is when it is working. I've been coding directly in the editor lately. I used to think it was impossible but now I realize just how cool it is.</p> https://www.lexaloffle.com/bbs/?tid=144781 https://www.lexaloffle.com/bbs/?tid=144781 Thu, 17 Oct 2024 01:09:08 UTC gamepad support please...(Linux) <p>I bought a couple of bluetooth gamepads off Amazon:<br /> KIWITATA 2.4G Wireless NES USB Controller<br /> Which are imitation NES classic, 2-button, D-pad, select start controllers.</p> <p>It gets recognized right away by my latest Linux Mint OS and works in Pico-8<br /> EXCEPT that both buttons do the same thing (I think they are both X).</p> <p>I ran this 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 _draw() cls() ?btn() end --both B and A output 32</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 sure enough I get different values for all the buttons except both B1 and B2 print 32.</p> <p>I've found this thread <a href="https://www.lexaloffle.com/bbs/?tid=3623">https://www.lexaloffle.com/bbs/?tid=3623</a> where one poster talks about the same problem. But its from 2016 and was for pocketCHIP and they solved it by getting a different controller.</p> <p>I've also installed the <a href="https://www.generalarcade.com/gamepadtool/">SDL2 gamepad-tool for Linux</a> but had issues. It sort of works EXCEPT that it wont recognize left/right on the dpad. I tried a million times and also tried skipping and mapping it to the little joysticks instead but it didn't work.</p> <p>my understanding is that I am to copy/paste the resulting mapping line into<br /> .lexaloffle/pico-8/sdl_controllers.txt<br /> but haven't yet because it doesn't do me any good without right and left on the dpad.</p> <p>I've got to think this is a pretty easy fix in 2024. Any suggestions?</p> <p>Or at least, which NES classic style wireless controllers DO work?</p> https://www.lexaloffle.com/bbs/?tid=144033 https://www.lexaloffle.com/bbs/?tid=144033 Wed, 04 Sep 2024 02:59:17 UTC Solitaire Chess -- Vol. 1 <p> <table><tr><td> <a href="/bbs/?pid=153005#p"> <img src="/bbs/thumbs/pico8_solitaire_chess_vol1-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=153005#p"> Solitaire Chess -- Vol. 1</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=153005#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Solitaire Chess</h1> <h3>About</h3> <p>68 solitaire chess puzzles. Drag and drop. Mouse only. Every move must be a capture, no check, king can be captured. Win by leaving only one piece. Lose if no remaining moves and more than one piece.</p> <p>There are two modes: puzzle rush and relax mode. Relax mode is recommended, but if you get to the end you don't get the winner screen and no points. In relax mode you can navigate to any puzzle by using the selector at top left and clicking &quot;GO&quot;. There is no clock or points and progress is not saved.</p> <p>In puzzle rush mode, points are based on how much time is left when a puzzle is completed. Each failure or reset of puzzle is minus 50 points. You can go negative and progress is saved. Clicking &quot;start fresh&quot; will delete all progress.</p> <p>Puzzles get harder and have more pieces but also more time as game continues.</p> <h3>Controls</h3> <ul> <li> <p>left mouse button: select, drag and drop</p> </li> <li> <p>middle mouse button: during game play, press for option button to reset puzzle. (so you don't need to play on when you know you are doomed.) hover and left or right click while holding middle button.<br /> (You will lose 25 points in puzzle-rush mode doing this).</p> </li> <li> <p>right mouse button: while piece is selected, right click on empty square to deselect piece. Or, while piece is selected, click on capture square to capture (useful to make multiple, consecutive captures without releasing selected piece).</p> </li> <li>menu: reset puzzle or toggle music on/off (each lose modal also has convenient music on/off button).</li> </ul> <h3>Credits</h3> <ul> <li> <p>The legal move generation was derived from Pico-Chess! cart #15045 by <a href="https://www.lexaloffle.com/bbs/?uid=11129"> @mrh</a>. It was very helpful and interesting.</p> </li> <li> <p>Easing functions from <a href="https://www.lexaloffle.com/bbs/?uid=26940"> @DocRobs</a> cart #58411 <a href="https://www.lexaloffle.com/bbs/?pid=58412#p">A selection of Easing Functions</a></p> </li> <li> <p>The opening theme song is my Pico-fied arrangement of <a href="https://freemusicarchive.org/music/caslo/caslo-vol-1/calling/"><em>Calling</em></a> by <a href="https://freemusicarchive.org/music/caslo/">Caslo</a>. <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/">(License)</a></p> </li> <li> </li> </ul> https://www.lexaloffle.com/bbs/?tid=143779 https://www.lexaloffle.com/bbs/?tid=143779 Wed, 21 Aug 2024 04:40:38 UTC Mate In 2 -- Vol. 3 (mouse required) <p> <table><tr><td> <a href="/bbs/?pid=151986#p"> <img src="/bbs/thumbs/pico8_matein2vol3-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=151986#p"> matein2vol3</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=151986#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Mate in 2 -- Vol. 3</h1> <h3>About</h3> <ul> <li>25 Mate-in-2 puzzles.</li> <li>Mouse required.</li> </ul> <h3>Controls</h3> <ul> <li>left mouse button : select / deselect pieces, squares or buttons.</li> <li>right mouse button: show hint-square during puzzle. hide modal after puzzle.</li> </ul> <h3>Upgrades from previous volumes</h3> <ul> <li>mouse makes for much better user experience.</li> <li>progress saved. start at last puzzle completed.</li> <li>white/black to move instead of just one color.</li> <li>improved wrong-move animation.</li> <li>expanded color palette.</li> <li>music (with easy on/off option at end of each puzzle).</li> </ul> <h3>Known bugs</h3> <ul> <li>if cart is left idle during a puzzle for a long time (like hours and hours), the wrong-move sprite animation gets messed up and instead of jiggling, the piece just drifts off to the side until returning to it's square. This is because <code>t()</code> is used with <code>cos()</code> to create the shake effect. When <code>t()</code> gets too big, it causes problems. It is within my tolerance level and so I don't mind. It never happens unless I forget that it is running all afternoon. Because this cart saves progress, it is no big deal to restart the cart. Or even play as-is since gameplay is not affected. In short, its a non-issue.</li> </ul> https://www.lexaloffle.com/bbs/?tid=143398 https://www.lexaloffle.com/bbs/?tid=143398 Wed, 31 Jul 2024 18:50:56 UTC 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;list=PLdT3OotRiHJlIZw05EqVXpdn3M8qB7AJZ&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