Gadzooka [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=11524 vector magnitude <p>Not really sure if this was mentioned anywhere, but I thought it might be useful for anyone who wants to make use of vector math, specifically calculating the length of a 2D vector, while minimizing the risk of overflow.</p> <p>Because the sqrt(32767) ~= 181, it is easy to overflow when using the textbook equation for calculating vector length:<br /> <table style="width:640px" cellspacing=0 cellpadding=10><tr><td bgcolor=#ffeedd><span style="color: #101010;">len = sqrt(x*x + y*y)<br></span></td></tr></table></p> <p>To derisk overflowing when squaring the terms, you can first scale down the vector's x and y components:<br /> <table style="width:640px" cellspacing=0 cellpadding=10><tr><td bgcolor=#ffeedd><span style="color: #101010;">m = max(x,y)<br /> x = x / m<br /> y = y / m<br></span></td></tr></table><br /> then scale the square root of their sums:<br /> <table style="width:640px" cellspacing=0 cellpadding=10><tr><td bgcolor=#ffeedd><span style="color: #101010;">len = sqrt(x*x + y*y) * m<br></span></td></tr></table><br /> Lua code (simplified since one term will always == 1):</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 length(v) local d = max(abs(v[1]),abs(v[2])) local n = min(abs(v[1]),abs(v[2])) / d return sqrt(n*n + 1) * d 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=28999 https://www.lexaloffle.com/bbs/?tid=28999 Sun, 19 Mar 2017 11:39:35 UTC Starting work on a new game... <p>Here's a capture of some of the movement animations.</p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/11524/xvi.gif" width=256 height=256 alt="" /> <p>Still lots to do. For this game I am using the awesome Pyxel Edit software to create the animations. It is so nice to be able to import and export spritesheets with pico-8.</p> <p>I'll hopefully have something more to post soon.</p> https://www.lexaloffle.com/bbs/?tid=3532 https://www.lexaloffle.com/bbs/?tid=3532 Thu, 02 Jun 2016 16:50:14 UTC HighSteel <p> <table><tr><td> <a href="/bbs/?pid=19561#p"> <img src="/bbs/thumbs/pico33610.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=19561#p"> HighSteel</a><br><br> by <a href="/bbs/?uid=11524"> Gadzooka</a> <br><br><br> <a href="/bbs/?pid=19561#p"> [Click to Play]</a> </td></tr></table> </p> <p>Climb to survive.</p> <p>Enjoy!</p> <p><table style="width:640px" cellspacing=0 cellpadding=10><tr><td bgcolor=#ffeedd><span style="color: #101010;">CONTROLS</p> <p>Movement: Left, Right, Up, Down<br /> A-Button: Jump<br /> B-Button: Use item in item box</p> <p>Keyboard:<br /> Player1 (yellow): Cursors + ZX / NM<br /> Player2 (white): SDFE + tab,Q / shift A<br></span></td></tr></table></p> <p><table style="width:640px" cellspacing=0 cellpadding=10><tr><td bgcolor=#ffeedd><span style="color: #101010;"><strong>* New high score: 228 (by flightrush)</strong><br></span></td></tr></table></p> <p>My personal high score video:</p> <p><object width="640" height="400"><param name="movie" value="https://www.youtube.com/v/7fw2UoSxrbw&hl=en&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/7fw2UoSxrbw&hl=en&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="400"></embed></object></p> https://www.lexaloffle.com/bbs/?tid=3183 https://www.lexaloffle.com/bbs/?tid=3183 Sun, 03 Apr 2016 08:49:37 UTC Working on a jumpman inspired game <p>Started work on a game based loosely on &quot;jumpman&quot; called &quot;HighSteal&quot;.</p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/11524/PICO-8_0.png" width=580 height=540 alt="" /> <p>I should be done in a few days... ok, maybe a week or so.</p> <p>So far it is coming along really well. My original though was to create a 2-player game, and if there was time and space, add a single player mode. </p> <p>I was so glad today when I upgraded to the latest pico-8 and found the code char limit had been doubled!!! Thank you!!!</p> <p>So I am now working on the single player mode, and I think it will work out well.</p> https://www.lexaloffle.com/bbs/?tid=3161 https://www.lexaloffle.com/bbs/?tid=3161 Thu, 24 Mar 2016 14:06:22 UTC Wizards Rule <p> <table><tr><td> <a href="/bbs/?pid=17568#p"> <img src="/bbs/thumbs/pico17567.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=17568#p"> Wizards Rule 1.0</a><br><br> by <a href="/bbs/?uid=11524"> Gadzooka</a> <br><br><br> <a href="/bbs/?pid=17568#p"> [Click to Play]</a> </td></tr></table> I made this &quot;fan&quot; game as an exercise to learn what I could do with pico-8. Pico-8 is such a great platform, and definitely challenging. My next effort will be something original. Enjoy!</p> https://www.lexaloffle.com/bbs/?tid=2867 https://www.lexaloffle.com/bbs/?tid=2867 Sun, 06 Dec 2015 18:13:55 UTC