I’m a complete UE4 beginner so I thought I would start off making a simple game. In this case a snake game.
I have made a blueprint for the snake that controls the movement and steering.
Is this the right thing to do? To have the logic in the snake itself? Or should i have the logic in the level blueprint instead?
Anyhow, it works and i can control the snakes head with the keyboard.
My problem is how I can create the tail.
I’m thinking:
On Event Begin Play do a for-loop of the amount of tail blocks and create them from a mesh
Store the coordinates of the head block in an array every “Event Tick”.
Do a for-loop of the amount of tail blocks and change these locations with data from the array
Is this a good way to go about this?
Do I have all this logic in the snake blueprint or in the level blueprint?
Any input is much appreciated.
Thanks,
EDIT:
I forgot to say that i’m having problems with step 2.
I cannot find a way to get the objects i create in step 1.
I use Get static mesh to create the tail.
You can assign their reference right after you spawn them to a variable somewhere, probably in an array of them. Or, you can search all actors of it’s type, then check the tag. The Tag is what you are looking for to give it an Id or name.
Making it a Blueprint will make it a little simpler.