Zellente [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=102128 Help with multiple button/keys pressed <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/102128/two_buttons_2.gif" alt="" /> <p>Hi, I try to make a one-button game and thought I could extend it to four players , maybe even using one controller (but yes two players on the direction pad might not work).</p> <p>On a keyboard 4 players could use the keys from both players, even esdf, for movement. Btnp() returns an integer that represents the pressed button/keys. e.g. 512 for player2,-&gt; (right).</p> <p>The players use the x (&quot;x&quot; and o (&quot;c&quot;) buttons and on keybord q,w. I could use btnp(4,0), btnp(5,0) and btnp(4,1),btnp(5,1) but it would use 4 &quot;if-statements&quot; instead of one and I want to use the keyboard and variable keysetting.</p> <p>I would like to have something like this:</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>playerbtn = {32,16,4096,8192} player[i] = {btnpressed = playerbtn[i]) for i=1,game.playernumber do if btnp() == player[i].btnpressed then some code 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>instead of four times this:</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>if btnp(5,0) then if player[1].movment &lt; 8 then player[1].movment += 2 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>but the for-statement doesn't catch all four playerkeys at once, the btnp()-version works with 4 keys pressed simultaneous.</p> <p>What do I miss?</p> <p>(full chart,but WIP, uncoment line 128/141 and comment line 142-182 to test my problem)<br /> <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 /> <table><tr><td> <a href="/bbs/?pid=156371#p"> <img src="/bbs/thumbs/pico8_wodijawuju-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=156371#p"> wodijawuju</a><br><br> by <a href="/bbs/?uid=102128"> Zellente</a> <br><br><br> <a href="/bbs/?pid=156371#p"> [Click to Play]</a> </td></tr></table> <br /> </div></div></div></p> https://www.lexaloffle.com/bbs/?tid=144962 https://www.lexaloffle.com/bbs/?tid=144962 Sun, 27 Oct 2024 20:52:01 UTC Can you import a map? <p>Today I finished some code restruction,from scatch and noticed I forgot to &quot;copy&quot; the sprites and the map and no problem<br /> <code>export foo.png //nice</code><br /> <code>export foo.map.png //nice</code><br /> and easy<br /> <code>import foo.png //nice</code> </p> <p>and<br /> <code>import foo.map.png //ups just spritesheet is full</code><br /> ? okay<br /> <code>import map foo.map.png //nope</code></p> <p>Of Course I can just copy the code to the cart with the map I want, but is there a command I didn't found? There are parameter import foobar.png -L, that do not help me.<br /> The Pico-8 manual has only export map...</p> https://www.lexaloffle.com/bbs/?tid=143982 https://www.lexaloffle.com/bbs/?tid=143982 Sun, 01 Sep 2024 08:08:35 UTC