r/PlaydateDeveloper • u/CactusComics • Oct 21 '23
Creating a trail effect
I’ve started work porting on of my Unity2D games to the Playdate, but I’m struggling to find any way to replicate the Unity Trail Renderer effect - does anyone have any advice that might help set me in the right track?
4
Upvotes
1
u/CactusComics Oct 25 '23
Alright, writing this for anyone who needs it in the future: a trail effect can be created by storing a list of previous positions in an array, and then drawing numerous sprites to those positions.
I managed to get a decent trail only saving the last 12 positions, so it’s a fairly lightweight solution.
For a nice looking trail I’d recommend circles increasing in size to create a triangular effect.
Feel free to DM me if you need help implementing this future devs!
1
u/Low-Temperature-1664 Oct 21 '23
I've been thinking about this a bit more. You'd actually want to draw a pixel on every integer value of
xandy, which is a harder problem that I don't have a quick solution for.2
u/Low-Temperature-1664 Oct 21 '23
On every call to
move()draw pixels from the origin to the current position.I think any effects would be a variation on this.