Building the Space Shooter Template
Templates
This tutorial explains how we built the Space Shooter template. The template is included ready-made in the Shoot 'em Up Kit and you can create a new game using it as a starting point.
Build the Game
Start the Shoot ‘Em Up Kit and select Create –> New Project -> Empty Project
Add a Project Name and set Camera to 2D with models, leave other options as the default value
Click OK to create the game
Select the Level Editor
Uncheck Grid (Tools menu) if you don’t want it shown
Select
Add a player on the Tools Menu, choose a ship and place centre bottom of screen. Leave the Player Definition, Input Definition and Movement Definition as defaults, this will allow the player to move left and right across the bottom of the screen and fire
Select
Add an NPC Generator on the Tools Menu, choose a ship and place it on the left of the screen above the player. Press escape to stop placing spawn points.
Rotate the ship to point to the right by using the
Rotate gizmo or entering values in the NPC Generator General Tab
In the NPC Generator General Tab, set Min and Max spawn time and Max Can generate. This sets the minimum and maximum time between ships spawning from the NPC Generator and the total number of ships to spawn.
Go to the AI tab, delete defaults (Fire and Chase) then choose Add AI Behaviour and set AI Type to Move +X
Repeat this to place 2 more ships, one top right and one middle left as shown. The one on the right will need to be rotated to face left, and the AI type will need to be set to Move -X
Add a Camera
using the Tools Menu, zoom in until the NPC generators are just off screen and the player ship is still visible (W/S or mouse wheel) then select Use Editor Camera View, this will set the camera game view to the current view so the ships will appear from off screen
Click the
Test Game or
Test Level icons on the Tool Bar to test the game. You should see 3 rows of enemy crossing. The player should move left and right and fire.
Next add a Mothership, a bigger, slower ship that occasionally crosses the top of the screen. It is set to give a higher score than the other ships and take 2 shots to destroy.
To do this,
Add an NPC Generator using the Tools Menu, choose a model and place it top left on the screen
Set Min and Max spawn times to a larger value than the other ship to give longer gaps (the template uses 8 and 12 seconds). Set Max Can Generate to 3 so only 3 motherships are generated in the game.
The Mothership will need different NPC and Movement Definitions. To create the new NPC Definition, go to NPC Definition in the Define menu and
copy the Axis Movement definition (the one used by the other ships)
Open the copy and rename it Mothership Axis Movement and change the health to 200. Also increase the Kill Score to 200 so it scores more points.
To create the new Movement Definition, go to Movement Definition in the Define menu and copy the Axis Movement definition (the one used by the other ships)
Open the copy
Set the Name, and make the Max Speed lower (the template uses 40)
Select the Mothership in the level and change the NPC Definition and Movement Definition to the ones you created.
To show an effect when the ship is damaged by the first hit, click the arrow by the Mothership Entity to open it in the Entity Editor
Go to the Effects tab, select the Damage Event and select a particle effect to show on damage, then go to the Confirm tab and select Done
The template game has a scrolling star background. To do this:
- On the Tools menu, select
Level Settings on the Tools Menu then Edit Background Settings
- Delete the sprite in Sprite Background
- Set a colour in Colour Background
- Set Sprite (star), Movement (Scroll -Y), Density (high) and Speed (50) in Generated Background
Options for Further Development
This gives the template game as provided with the Shoot ‘Em Up Kit. Options for taking it further could be:
- Create Movement Definitions with different speeds (as for the Mothership) so all rows move at different speeds
- Create NPC Definitions with different kill scores (as for the Mothership) so ships in different rows give different scores
- Change the player weapon – the template has the default ‘Bullet Green’ player bullet. To change this select the player, go to the Weapons Tab and select a different weapon definition, or create a new one using Weapon Definitions on the Define menu
- Change the rate at which NPCs are generated in the NPC Generator General Tab
- Add more lanes of NPCs
- Add more spawn points for each NPC Generator so the ships don’t all spawn at the same point