Spline Editor

Published 2023-06-12


This is a tool for creating and editing splines within your game. I used this initally for a shmup i was working on where I wanted to create an intresting enemy flight pattern.

The black area represents a 128x128 screen.

Just click in the points you want then press CTRL+C to copy to clipboard This will copy all points to the clipboard as a string.

This string can be then used within your game.

This is what I use it for.

You can test out pasting of splines here. Also this cart has code for handling the splines.


copy the following code to your cart (this can also be read from tab 2 of the demo cart)

Generate curves using the main cart that represent how you would like your mobs to move. Just click different points into place. Note that the black area represents a whole screen of 128x128 pixels.

You can click and drag points around, press delete to delete the last point. When you are happy with your curve press CTRL+C to copy a string to the clipboard.

NOTE: Sometimes the string doesn't copy correctly in the web player, if this happens from pico-8 you can load #spline and run the cart locally. The copy seems far more reliable when running in pico-8

Paste the following into your _init() function.

path=read_spline(split(*your pasted string*))

Then whenever you want a point along the path you just call path using the decimal of what portion of the path you want covered.

local point = path(0) Will give you the start point of the path
local point = path(0.25) Will give you a point 1/4 the way through the path.
local point = path(1) Will give you a point at the end of the path.

Feel free to look at the demo cart for code that uses a sprite.

Now cart accepts pasting of splines not just upload.
Now curves are more round by default

Thanks to @pancelor for the idea about the splines.
Thanks to @Heracleum for assistance writing up how to use the cart.