I’m just putting the finishing touches on my endless runner. I now have shooting animations linked up.
I have a separate GameObject for the body and the legs. When the player shoots, I simply tell the top animation to switch from shooting or to running. The legs stay the same. After that I simply spawn new bullets every time I detect the fire button was pressed.
Here you can see I didn’t set up the logic to destroy the bullets which looks kinds of funny. Without that final piece of logic, the simply collect on any other GameObject with a solid collider.
Finally, I have all the logic in place and I added a little recoil which pushed the player backwards every time they shoot.
This subtle touch adds a little bit of balance to the game. It forces the player to decide if they want to shoot their guns they are going to get pushed closer towards the mob of zombies on the far side of the screen. So now shooting the gun becomes a last ditch effort, while the main focus is to simply try to jump over obsticals.