In this example I made a simple target shooting game using the unreal engine with a mixture of C++ and blueprints.
I used assets from Unreal’s starter pack for the targets and the first person shooter template assets for the gun and character. I changed the size and velocity of the projectile to make it feel more like an Airsoft gun.
The goal of the game is to destroy all of the targets in the level as fast as you can and to beat your personal best time. A timer and your current personal best time are displayed in the top left of the screen.
The game starts with the main menu screen with buttons linking to the 2 levels, the options menu, the controls menu, and a button to exit the game.
If you would like to play this game for yourself you can download it from this link: https://drive.google.com/drive/folders/1JiJIO52HbmsPcaCThJYifFI9ilMEsfGJ?usp=sharing
I’ll be talking about three main assets in my game:
Targets and Moving Targets
- I’m just using green balls, but if I had 3D design skills I would replace them with actual targets.
- On collision, targets will check if there are any other targets in the level, if there aren’t it will tell the player to check the timer.
- Then it will destroy itself.
- For moving targets it has two new empty spheres. It will move from one sphere to the other in the speed given.
Random Spawner
- In blueprints it gathers an array of all “possible spawn” actors in the level
- In c++ code it takes the array of possible spawn actors and chooses half of them
- Then back in blueprints it will spawn a target actor in place of all chosen possible spawns
Save Game
- There is a user variables blueprint that stores sensitivity, level 1 PB, and level 2 PB.
- In all places it is used, on begin play a save reference is made and the variables needed are saved.
- To save the game it will change the variables on the save reference and create a new save game with that reference.
What would I add if I wanted to continue with developing the game?
- Effect when you beat your PB
- Targets instead of Green Balls
- Airsoft gun instead of unreal’s default gun
- Slide
- Run animation
- Global Leaderboard
- Sound Effects