You are reading Part 7 of the Space Shooter Tutorial.
- Space Shooter, Part 1
- Space Shooter, Part 2
- Space Shooter, Part 3
- Space Shooter, Part 4
- Space Shooter, Part 5
- Space Shooter, Part 6
- Space Shooter, Part 7
- Space Shooter, Part 8
- Space Shooter, Part 9
- Space Shooter, Part 10
- Space Shooter, Part 11
- Space Shooter, Part 12
- Space Shooter, Part 13
In this chapter, we will learn how to add meteors to the game.
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:
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.
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.
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.