Hi guys, just needing help with how I would create a “snake” character for a game like the old snake game for the Nokia. How would I be able to generate a new “body” for the snake when it goes over a pickup and then have that move with the snake.
Do you want that kind of grid system or a dynamic one?
In a grid system you just create an array of body parts which take the position of the one in front of them each tick and the first one goes where the user input tells it to. If you want to add a piece you can just spawn a new one of those actors and add it to your array.
With a dynamic one you probably want to use a spline with a set point for each unit… you should read up on splines if you wanna go this path. It’ll make everything quite a bit easier.
I hope this helps.
Cheers
Hi there, and the grid system is what I’m going for, I’m not really skilled in the blueprints area so would you be able to explain how I would go around to do that? Thanks.
Well what do you wanna know?
Just upfront I will not create this whole game for you.
The usual snake approach is you have single blocks listed in an array and depending on the implementation either moving all of them around or always deleting the last one (except you picked up a block) and spawning one right behind the head.
You create a grid and take care that your character will only move on this grid (a grid is nothing else than a set larger amount of units. So your snake won’t be able to be at (for example) 0.042 but only on 0 and then as next grid box let’s say 50. Nothing in between).
Then you do all the movement and you’re good.