Skip to content

7. Meteors

Series

You are reading Part 7 of the Space Shooter Tutorial.

  1. Space Shooter, Part 1
  2. Space Shooter, Part 2
  3. Space Shooter, Part 3
  4. Space Shooter, Part 4
  5. Space Shooter, Part 5
  6. Space Shooter, Part 6
  7. Space Shooter, Part 7
  8. Space Shooter, Part 8
  9. Space Shooter, Part 9
  10. Space Shooter, Part 10
  11. Space Shooter, Part 11
  12. Space Shooter, Part 12
  13. Space Shooter, Part 13

Tip

In this chapter, we will learn how to add meteors to the game.

Adding Meteors

We will add four meteor objects. Add a new object called "Meteor1", and select the "meteor_1.png" from the assets folder.

Repeat the same process to add all four meteors. Then your objects should look like this:

We will use object groups to control multiple meteor objects at once, especially in the events. Create a new object group called "Meteors" and add the meteor objects.

Then you should see:

Hitting meteors

Open the Events tab and copy the condition and the action (Player collision with BulletEnemy), then paste it. Replace BulletEnemy in the condition and the Delete action with Meteors and ensure that IsDamaged is equal to 30.

Add a new condition to detect the collision between Bullet and the Meteors.

Tip

Our bullets will be gone when they hit meteors.

Then, add an action to delete "Bullet" objects. In the end, your events should look like below.

Testing out

Before testing out the meteors, we should put some meteor objects on the scene. Drag and drop some meteor items on the scene.

Run the game. Now you can see the meteors on the scene. If you hit some meteors, the player will get some damages.

Next step

Space Shooter, Part 8