ThaCuber [Lexaloffle Blog Feed] vector.p8: A simple and lightweight vector math library <p> <table><tr><td> <a href="/bbs/?pid=121553#p"> <img src="/bbs/thumbs/pico8_vector_p8-3.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=121553#p"> vector.p8 v1.2.1</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=121553#p"> [Click to Play]</a> </td></tr></table> </p> <h1>vector.p8</h1> <p>a simple and lightweight (in tokens) vector math library for PICO-8. this library contains no error handling <em>at all</em>. it's a side effect of keeping it low in tokens, so you're gonna have to be responsible of whatever goes in.</p> <p>usage:</p> <ul> <li><code>load #vector_p8</code></li> <li>save as such: vector.p8.</li> <li>remove all the demo code; it's in the second tab.</li> <li><code>#include</code> in any cart you want.</li> </ul> <h2>functions within:</h2> <h3>creation and management</h3> <p><code>vector(x,y,z)</code> - <em>the</em> function. vectors are just normal Lua tables with <code>x</code>, <code>y</code> and <code>z</code> fields, so you can pass any table that contains x, y and z to any of the functions and it'll work just fine.</p> <p><code>v_polar(length,angle)</code>- makes a vector using polar coordinates.<br /> <code>v_rnd()</code> - gives a normalized vector with a random direction.</p> <p><code>v_cpy(v)</code> - copies a vector.<br /> <code>v_unpck(v)</code> - unpacks a vector.<br /> <code>v_arr(v)</code> - returns a vector as an array of the 3 components that comprise it. Ignore the third value (Z) if your vector is a 2D one.<br /> <code>v_tostr(v,d)</code> - turns a vector into a string. The <code>d</code> parameter is used to know if it should be printed as a 3D vector or not.<br /> <code>v_isvec(v)</code> - checks if a certain value is a vector.</p> <h3>actual math</h3> <p><code>v_add(a,b)</code> - adds two vectors of any dimension.<br /> <code>v_sub(a,b)</code> - subtracts two vectors of any dimension.<br /> <code>v_scl(v,n)</code> - scales a vector by a scalar (normal number).<br /> <code>v_mul(v,n)</code> - alias for <code>v_scl</code>.<br /> <code>v_div(v,n)</code> - scales a vector by the inverse of a scalar (&quot;divides&quot; the vector).</p> <p><code>v_dot(a,b)</code> - computes the dot product of two vectors.<br /> <code>v_cross(a,b)</code> - computes the cross product of two 3D vectors.<br /> <code>v_magsq(v)</code> - computes the magnitude squared of a vector.<br /> <code>v_mag(v)</code> - computes the magnitude of a vector.<br /> <code>v_dstsq(a,b)</code> - computes the distance squared between two vectors.<br /> <code>v_dst(a,b)</code> - computes the distance between two vectors.<br /> <code>v_norm(v)</code> - normalizes a vector.<br /> <code>v_perp(v)</code> - gets a 2D vector perpendicular to the passed one.<br /> <code>v_sprj(a,b)</code> - returns the scalar projection of one 2D vector in another.<br /> <code>v_proj(a,b)</code> - returns the actual projection of one 2D vector in another.</p> <h3>rotation related functions</h3> <p><strong>WARNING!</strong><br /> none of these functions work with 3D vectors. all of them work with revolutions according to PICO-8's convention.</p> <p><code>v_rot(v,t)</code> - Rotates a vector by an angle <code>t</code>.<br /> <code>v_ang(v)</code> - Gets the direction a vector is pointing towards.<br /> <code>v_atwds(a,b)</code> - Gets the angle needed to point towards another vector.</p> <h3>miscellaneous</h3> <p><code>v_lerp(a,b,t)</code> - linearly interpolates two vectors.<br /> <code>v_flr(v)</code> - floors a vector.<br /> <code>v_eq(a,b)</code> - checks if two vectors are equal.</p> <h2>constants</h2> <p><strong>WARNING!</strong><br /> because of the way Lua tables work, do <strong>NOT</strong> use compound assignments to alter a variable if you directly assign one of these constants to it. either copy the constant using <code>v_cpy</code> and then assign that to the variable or use one of the functions within the library to manipulate it.</p> <p><code>v_right</code> - rightwards pointing vector.<br /> <code>v_left</code> - leftwards pointing vector.<br /> <code>v_up</code> - upwards pointing vector. Y points downward in 2D so this vector points towards -Y.<br /> <code>v_down</code> - downwards pointing vector. Y points downward in 2D so this vector points towards +Y.</p> <p><code>v_above</code> - 3D vector pointing upwards. unlike 2D, Y in 3D points upwards, so this vector points towards +Y.<br /> <code>v_below</code> - 3D vector pointing downwards. unlike 2D, Y in 3D points upwards, so this vector points towards -Y.<br /> <code>v_front</code> - 3D vector pointing forwards.<br /> <code>v_back</code> - 3D vector pointing backwards.</p> <p><code>v_zero</code> - zero vector. all components are set to 0.<br /> <code>v_one</code> - identity vector. all components are set to 1.</p> <p><code>v_cntr</code> - utility vector pointing towards the center of the screen, i.e. [64,64].</p> <h2>changelog</h2> <p>v1.2.1 (11-03-2023):</p> <ul> <li>thought I had fixed all functions that used <code>v_getd</code>, but turns out one function I hadn't added to the docs, <code>v_flr</code>, still used it.</li> <li>documented <code>v_flr</code>.</li> <li>improved explanation for <code>v_atwds</code>.</li> </ul> <p>v1.2 (06-12-2022):</p> <ul> <li>fixed the math functions <code>v_add</code>, <code>v_sub</code>, <code>v_scl</code>, <code>v_div</code> and <code>v_neg</code> using the now-defunct <code>v_getd</code> function.</li> </ul> <p>v1.1 (09-11-2022):</p> <ul> <li>removed all dimension related functions.<br /> Consequently, a parameter was added to v_tostr for it to know how to format the output.</li> <li>added <code>v_sprj</code> and <code>v_proj</code>.</li> <li>renamed <code>v_center</code> to <code>v_cntr</code>.</li> </ul> <p>v1.0 (09-11-2022):</p> <ul> <li>initial release</li> </ul> Tue, 29 Nov 2022 14:31:18 UTC Risky Honey <p>Description from the <a href=""> page</a>:</p> <p>You're a bee, and for some reason I still do not comprehend, you decided to get some honey. In the middle of the rain. The drops are twice as bigger than you. You might die if you get hit by one. And the rain gets worse the more honey you collect. That wasn't the best idea you've gotten.</p> <p><strong>Made in 4 hours for the Crunchy Jam, hosted by <a href="">Celesmeh</a>.</strong></p> <p>Still has noticeable bugs, since I couldn't get time for enough bugfixing sadly.</p> <p> <table><tr><td> <a href="/bbs/?pid=113059#p"> <img src="/bbs/thumbs/pico8_riskyhoney-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=113059#p"> riskyhoney</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=113059#p"> [Click to Play]</a> </td></tr></table> </p> Sun, 12 Jun 2022 15:56:03 UTC spaceship game (placeholder name) <p> <table><tr><td> <a href="/bbs/?pid=97024#p"> <img src="/bbs/thumbs/pico8_spaceshipgame-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=97024#p"> Spaceship game</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=97024#p"> [Click to Play]</a> </td></tr></table> </p> <p>A game about shooting aliens that i made cause boredom.<br /> The collision system is also trash but i can't make it better <table><tr><td width=0> <img src="" width=0 height=0> </td> <td valign=bottom> <a style="cursor:pointer;font-size:8pt" onclick=' var el = document.getElementById("gfxcode_47247_0"); if ( == "none") = ""; else = "none"; microAjax("", function (retdata){ var el = document.getElementById("gfxcode_47247_0"); el.innerHTML = retdata; el.focus();; } ); '> [0x0]</a> </td></tr> <tr><td colspan=2> <textarea rows=3 class=lexinput id="gfxcode_47247_0" style="width:640px;background-color:#fed;display:none;overflow:hidden; font-size:6pt;"></textarea> </td> </tr> </table> </p> <p>Anyways, it's pretty cool and i have like 3 days working on it, so please tell me what you think in the comments too!<br /> and also <code>print(&quot;have a good day :D&quot;)</code></p> Tue, 07 Sep 2021 21:17:12 UTC sand and water test <p>sand and water</p> <p>and yes, the physics are wrong, don't need to tell me</p> <p> <table><tr><td> <a href="/bbs/?pid=94228#p"> <img src="/bbs/thumbs/pico8_sand-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=94228#p"> sand and water</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=94228#p"> [Click to Play]</a> </td></tr></table> </p> Tue, 29 Jun 2021 23:01:25 UTC EDGE Demake 0.2 <p> <table><tr><td> <a href="/bbs/?pid=86968#p"> <img src="/bbs/thumbs/pico8_edge2-2.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=86968#p"> EDGE Demake 0.2</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=86968#p"> [Click to Play]</a> </td></tr></table> </p> <h3>New things:</h3> <ul> <li>A level editor that doesn't really work well</li> <li>Climbing</li> <li>More bugs</li> <li>My brain hurts</li> </ul> <p>Yeah, i don't really thing i will go on with this project. Well, it depends.</p> <p>Depends in if my coding skills are enough to continue this thing.</p> <p><em>i dont think so</em></p> Sat, 30 Jan 2021 16:01:21 UTC EDGE Prototype <p> <table><tr><td> <a href="/bbs/?pid=86690#p"> <img src="/bbs/thumbs/pico8_edge-2.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=86690#p"> EDGE Demake 0.1</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=86690#p"> [Click to Play]</a> </td></tr></table> </p> <p>Please don't ask me why i do tutorials and immediately come with a game remake coded all by myself. Just play this.</p> <p>This is a 2D remake of a game i've always wanted to remake somewhere else. I ended remaking it in PICO-8 (here), which is an uncomfortable thing since the original game is in 3D, and this thing is in 2D. But i'll be cool and say that this is a demake instead. For now it's just a very hecking early alpha, but i'll be working on it.</p> <p>Also also, i don't know if i'll be able to code moving platforms.</p> <h3>To-do:</h3> <p>The ability to climb blocks, if it isn't there how could i call this an EDGE Remake.<br /> Not being able to move in certain places ( for example, when you're trapped in a little tunnel )<br /> The collectables, win, lose, and all the other things that need to be here and if not i could hardly call this <em>a game</em>.<br /> And a lot more things.</p> <p>Anyways, hope you like this thing, it's my first PICO-8 project with no tutorials, and because of it i'm so proud of it. Even though it's a copy of another game.</p> <p>And yes, you can edit it according to the Creative Commons license.</p> <p>Stay cool and see ya!</p> <ul> <li>Tha Cuber</li> </ul> Fri, 22 Jan 2021 22:44:20 UTC Basic pong game <p> <table><tr><td> <a href="/bbs/?pid=86121#p"> <img src="/bbs/thumbs/pico8_basicpong-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=86121#p"> Pong Game</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=86121#p"> [Click to Play]</a> </td></tr></table> </p> <p>A basic pong game.</p> <p>Thanks to <a href=""> @Krystman</a> for the tutorials.</p> <p>Also sorry too because i literally changed almost nothing.</p> Mon, 04 Jan 2021 02:43:16 UTC PICO-8 discord server? <p>Is there a <strong>PICO-8 official discord server</strong>?</p> <p>If there is, how can I join?</p> <p>If there isn't, are there any plans to make one?</p> <p>Because I would <em>like</em> to have one.</p> <h3>Off-Topic</h3> <p>Also, I'm getting better at PICO-8.</p> <p>Kinda.</p> Wed, 30 Dec 2020 17:01:48 UTC got a freaking awesome idea <h2>What if i, instead of doing games, i make mechanics for games?</h2> <p>i feel like this is a good idea.</p> <p>puzzlescript.</p> Wed, 23 Sep 2020 19:08:51 UTC Hit Test <p>Hi! I'm here again and i'm testing a hitbox thing.</p> <p>Also you can walljump. How interesting.</p> <p>And double jump. i'm awesome.</p> <p><strong>Btw im not gonna use it, 2 hard 4 me</strong></p> <p> <table><tr><td> <a href="/bbs/?pid=82120#p"> <img src="/bbs/thumbs/pico8_sayudiziwo-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=82120#p"> Hit test</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=82120#p"> [Click to Play]</a> </td></tr></table> </p> <p>Also, just a fun fact, i make Puzzlescript games.</p> <p>That's it, i wasted your time.</p> Tue, 22 Sep 2020 19:30:03 UTC Something <p><strong>The header of my account is one of my so many Puzzlescript games.</strong></p> <p>That's it, i wasted your time.</p> Tue, 22 Sep 2020 03:22:46 UTC First Game <p>Hi! I'm ThaCuber! I want to post here my first game ever on here, even though i didn't finished it.</p> <p>Please tell me guys what you thnk about it!</p> <p><strong>btw yes i used <a href=""> @MBoffin</a>'s top down game tutorial, don't tell that on the comments pls</strong></p> <p> <table><tr><td> <a href="/bbs/?pid=82072#p"> <img src="/bbs/thumbs/pico8_mahiyajimu-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=82072#p"> The Dungeon King</a><br><br> by <a href="/bbs/?uid=47247"> ThaCuber</a> <br><br><br> <a href="/bbs/?pid=82072#p"> [Click to Play]</a> </td></tr></table> </p> <p>Oh, and, i am proud of it, i don't care if you don't</p> Tue, 22 Sep 2020 01:49:37 UTC