ThaCuber [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=47247 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-12.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=121553#p"> vector.p8 v2.3</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.</p> <p>usage:</p> <ul> <li><code>load #vector_p8</code> and 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> <p>&gt; NOTE:<br /> &gt; vectors are just normal Lua tables with <code>x</code> and <code>y</code> fields, so you can pass any table that contains <code>x</code> and <code>y</code> to any of the functions and they will work regardless.</p> <h3>creation and management</h3> <p><code>vector(x,y)</code> - the main function. <code>x</code> and <code>y</code> default to <code>0</code></p> <p><code>v_polar(angle, length)</code> - makes a new vector using polar coordinates<br /> <code>v_rnd()</code> - returns a normalized vector with a random direction</p> <p><code>v_copy(v)</code> - returns a copy of <code>v</code><br /> <code>v_unpack(v)</code> - returns the components of <code>v</code> separately<br /> <code>v_tostr(v)</code> - turns a vector into a string, appropriate for both debugging and normal output. it looks like <code>[x, y]</code></p> <h3>actual math</h3> <p><code>v_add(a,b)</code> - returns <code>a</code> + <code>b</code><br /> <code>v_sub(a,b)</code> - returns <code>a</code> - <code>b</code><br /> <code>v_scale(v,n)</code> - returns <code>v</code> scaled by <code>n</code><br /> <code>v_mul(v,n)</code> - alias for <code>v_scale</code><br /> <code>v_div(v,n)</code> - returns <code>v</code> scaled by the inverse of <code>n</code></p> <p><code>v_dot(a,b)</code> - returns the dot product of <code>a</code> and <code>b</code><br /> <code>v_magsq(v)</code> - returns the squared magnitude of <code>v</code><br /> <code>v_mag(v)</code> - returns the magnitude of <code>v</code><br /> <code>v_distsq(a,b)</code> - returns the squared distance between <code>a</code> and <code>b</code><br /> <code>v_dist(a,b)</code> - returns the distance between <code>a</code> and <code>b</code><br /> <code>v_norm(v)</code> - returns <code>v</code>, normalized</p> <p><code>v_perp(v)</code> - returns a vector clockwise-perpendicular to <code>v</code><br /> <code>v_proj(a,b)</code> - returns the projection of <code>b</code> onto <code>a</code><br /> <code>v_dir(a,b)</code> - returns a normalized vector that points towards <code>b</code>, with origin at <code>a</code>.</p> <p><code>v_rot(v,t)</code> - returns <code>v</code> rotated to point towards angle <code>t</code>.<br /> <code>v_rotby(v,t)</code> - returns <code>v</code> rotated by <code>t</code>.<br /> <code>v_angle(v)</code> - returns the angle denoted by <code>v</code></p> <h3>miscellaneous</h3> <p><code>v_lerp(a,b,t)</code> - linearly interpolates from <code>a</code> to <code>b</code> by <code>t</code><br /> <code>v_flr(v)</code> - returns <code>v</code>, with all its components floored</p> <h2>constants</h2> <p>&gt; <strong>WARNING!</strong><br /> &gt; 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.<br /> <code>v_one</code> - identity vector. all components are set to 1.<br /> <code>v_center</code> - utility vector pointing towards the center of the screen, i.e. [64,64].</p> <h2>changelog</h2> <h3>format: dd-mm-yyyy</h3> <p>v2.3 (23-10-2024):</p> <ul> <li>fixed <code>v_lerp</code> using <code>v_scl</code> instead of <code>v_scale</code> or <code>v_mul</code></li> <li><code>v_rot</code> rotates <em>to</em> <code>t</code>, not <em>by</em> <code>t</code>; changed the docs of <code>v_rot</code> to mention that, and added <code>v_rotby</code></li> <li>post related update: removed the &quot;rotation related functions&quot; section; not exactly useful</li> </ul> <p>v2.2 (02-10-2024):</p> <ul> <li>fixed undefined global call to <code>v_dstsq</code> in <code>v_dist</code> (see v2.0 changelog)</li> <li>added version number to cart title</li> <li>programmed a new demo! check the second tab in the editor (tab 1)</li> </ul> <p>v2.1.1 (02-10-2024):</p> <ul> <li>accidentally switched x and y around in <code>v_angle</code>, sorry about that</li> </ul> <p>v2.1 (02-10-2024):</p> <ul> <li>the calls to cos and sin in <code>v_polar</code> were swapped with each other</li> <li>the formula for <code>v_proj</code> was <a href="https://en.wikipedia.org/wiki/Vector_projection">taken from Wikipedia</a>, and it projects b onto a, not a onto b; the docs were updated to reflect that</li> </ul> <p>v2.0 (24-05-2024):<br /> almost a 50% reduction on tokens, in exchange for various breaking changes:</p> <ul> <li>removed <code>v_eq</code>, <code>v_zero</code>, <code>v_atwds</code>, <code>v_isvec</code>, <code>v_arr</code> and <code>v_sprj</code></li> <li>removed z component from all functions, the 3D constants and <code>v_cross</code><br /> as in, this library no longer supports 3D math. sorry. it was oddly shoehorned in though, so I really wouldn't have relied on it that much.</li> <li>added <code>v_dir</code>, taken from a mod of the library done by snale</li> <li>optimized <code>v_lerp</code>, <code>v_sub</code> and <code>v_rot</code></li> <li><code>v_proj</code> now uses the proper definition for vector projection</li> <li>extended the names of some functions: <ul> <li><code>v_cpy</code> -&gt; <code>v_copy</code></li> <li><code>v_unpck</code> -&gt; <code>v_unpack</code></li> <li><code>v_scl</code> -&gt; <code>v_scale</code></li> <li><code>v_ang</code> -&gt; <code>v_angle</code></li> <li><code>v_cntr</code> -&gt; <code>v_center</code></li> <li><code>v_dst</code> -&gt; <code>v_dist</code></li> <li><code>v_dstsq</code> -&gt; <code>v_distsq</code></li> </ul></li> </ul> <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> https://www.lexaloffle.com/bbs/?tid=50410 https://www.lexaloffle.com/bbs/?tid=50410 Tue, 29 Nov 2022 14:31:18 UTC Risky Honey <p>Description from the <a href="https://thacuber.itch.io/risky-honey">itch.io 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="https://twitter.com/CelesMeh">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> https://www.lexaloffle.com/bbs/?tid=48134 https://www.lexaloffle.com/bbs/?tid=48134 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="https://www.lexaloffle.com/bbs/gfxc/47247_0.png" width=0 height=0> </td> <td valign=bottom> <a style="cursor:pointer;font-size:8pt" onclick=' var el = document.getElementById("gfxcode_47247_0"); if (el.style.display == "none") el.style.display = ""; else el.style.display = "none"; microAjax("https://www.lexaloffle.com/bbs/gfxc/47247_0.txt", function (retdata){ var el = document.getElementById("gfxcode_47247_0"); el.innerHTML = retdata; el.focus(); el.select(); } ); '> [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> https://www.lexaloffle.com/bbs/?tid=44554 https://www.lexaloffle.com/bbs/?tid=44554 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> https://www.lexaloffle.com/bbs/?tid=43603 https://www.lexaloffle.com/bbs/?tid=43603 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> https://www.lexaloffle.com/bbs/?tid=41334 https://www.lexaloffle.com/bbs/?tid=41334 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> https://www.lexaloffle.com/bbs/?tid=41246 https://www.lexaloffle.com/bbs/?tid=41246 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="https://www.lexaloffle.com/bbs/?uid=16423"> @Krystman</a> for the tutorials.</p> <p>Also sorry too because i literally changed almost nothing.</p> https://www.lexaloffle.com/bbs/?tid=41064 https://www.lexaloffle.com/bbs/?tid=41064 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> https://www.lexaloffle.com/bbs/?tid=40990 https://www.lexaloffle.com/bbs/?tid=40990 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> https://www.lexaloffle.com/bbs/?tid=39702 https://www.lexaloffle.com/bbs/?tid=39702 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> https://www.lexaloffle.com/bbs/?tid=39682 https://www.lexaloffle.com/bbs/?tid=39682 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> https://www.lexaloffle.com/bbs/?tid=39671 https://www.lexaloffle.com/bbs/?tid=39671 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="https://www.lexaloffle.com/bbs/?uid=10198"> @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> https://www.lexaloffle.com/bbs/?tid=39669 https://www.lexaloffle.com/bbs/?tid=39669 Tue, 22 Sep 2020 01:49:37 UTC