getting-started/space-invaders/README.md

44 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2020-04-09 19:10:01 +02:00
# Zeus Invaders
2020-04-03 02:34:14 +02:00
2020-04-09 19:10:01 +02:00
We'll give some general pointers on how to make this Space Invaders based game.
## Game description
The player controls a ship which can shoot bullets at a group of aliens. The aliens move to one side (right or left) of the screen, and move one space down when reaching the edge. The ships then speed up once they've moved down.
## Game structure
![Project structure](readme-assets/structure.png)
The general game structure we used is pretty simple, comprising of a player-controlled ship, a group of enemies, a node which randomly spawns a UFO which grants extra points, a GUI and a camera node to have some easier control over what the player sees.
We advise the reader to implement the nodes in the order presented in this README.
### 1. Ship
The ship should contain code which responds to the player pressing the arrow keys or the spacebar.
**TASK**: Implement player movement in the script of the ship. Make use of the `delta` parameter available in the `_process` function to vary the `position.x` of the ship node. Add a **Sprite** node with an image (placeholder will suffice for now).
### 2. Bullet
Common for both the enemies and the ship is the fact they can shoot bullets.
**TASK**: Create a Bullet scene containing a sprite and a Collision box. Collision can be obtained by adding an Area2D node and adding a CollisionShape2D node as its child. Have the Bullet scene move upwards continuously and let it despawn using `queue_free()` when it reaches the edge of the screen.
**TASK**: Check for collision with player or enemies. Quick tip: make use of groups
**TASK**: Add code to the ship which spawns this bullet scene at the current `global_position` of the ship. Make use of `preload()` to load the scene into memory.
### 3. Enemy
**TASK**: Create an Enemy scene which can be almost completely analogous to the ship. It contains a Sprite and a way to detect collisions.
### 4. Enemies
The enemy spaceships can be combined with one general "enemies" node. This controls the movement of the group of enemies, moving a discrete amount of time to one side, moving down when reaching the end of the screen.
![Enemies](readme-assets/enemies.png)
**TASK**: Create a node "Enemies". Populate with a couple of individual Enemy scenes (can right now just contain a single sprite). Create a **Timer** node and connect its timeout signal to the script of the group of enemies. This should then trigger a single movement of the group. Also add a **Bullet** spawner which randomly spawn downward facing bullets.