Crash Course 2: Invaders - Part 11

by Hectate (Updated on 2015-05-02)

Part 11: Destroying Bullets

If we didn't do something to remove Bullets from the game correctly, it might eventually affect performance (assuming the player shoots as much as we expect them to). Lets set something up to destroy our Bullets at a couple of key times. Switch to your Bullet actor type's Event tab.

Step 78: Add an Actor of Type Collision Event (click + Add Event button on the left, then select the Event, as shown).

Step 79: Set the Actor Type to Enemy Ship, then drag over a Kill [Self] block from the Palette (under Actor -> Properties).

Now each Bullet Actor will be destroyed when it collides with an Enemy Ship.

Step 80: Next, to ensure our Bullets are also destroyed when they leave the screen, we need to add an Actor Event, when a Specific Actor Enters or Leaves the Screen, as shown:

Step 81: Change the dropdowns on the Event block that appears from enters to exits, and from scene to screen, then drag over a Kill [Self] block (Actor -> Properties in the Palette).

If you were to test your game now, you would probably notice that the bullets don't get destroyed when they collide with the enemies. The reason for this is that the collision group for the bullets is not set to collide with the enemies.

Step 82: Select the Bullet actor type's Properties tab, and make sure that the Group is set to Bullets. Then click "Edit Groups". The Collision Group section of Game Settings will open up. Make sure that the "Bullets" group is highlighted to the right and then click the "Enemies" group so it turns green (as in the image below).


Save your game and test it; now the bullets should be disappearing if they collide with the enemies. Next, it’s time to set up what actually happens when Bullets collide with the Enemy Ships, instead of just removing the bullets from the game.

Click here to go to Part 12.

Disclaimer: Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!


@Gwvo The "self" and "last created actor" options are selected in the same place, if you are talking about the "kill" action, then this action (at least in the most recent version) appears as "kill actor" but it changes automatically to "self" when you put it in place, if you want to change it, just click in "self" (Or "actor" if by some reason it doesn't changes for you)
0 2 weeks, 1 day ago
Hello ,

I can't find the ''self'' button, and the "latest created actor" doesn't work and also "add specific actor" or even "choose actor" because the bullet isn't in the choose of actor....

If someone can find the solutions already mentionned years ago ...

Thank you

0 3 months, 2 weeks ago
Arrrgh The bullets Do Not Disappear When they Hit The Enemy Ships
0 3 months, 3 weeks ago
Small side-notion:
There seems to be outdated information in the tutorial. Currently step 81 says that there is no collision set for Bullet vs. Enemy, but in Part 3, this was actually already set.

Though if someone wanders here randomly, it is good to mention that this might be the issue. So don't remove the text entirely. Maybe remind/direct them to Part 3?

1 7 months, 2 weeks ago
@NEXCODING did you set the bullet's collision group to "Enemies"?
0 1 year, 1 month ago
The bullets don't dissapear when it comes in contact with the enemy ship
0 1 year, 2 months ago
I have a problem with some of this tutorial, my bullets do not come into contact with enemy ships. Yet I checked several times if the width collisions were of course "Enemies". I also check for enemy ships.
Can someone inform me?

2 1 year, 4 months ago
What is the different between scene and screen?
0 2 years, 5 months ago
@BOSS1sCOOL - Make sure you select "Specific Actor" when you create the event and not something like "Actor of Type". It works fine for me on 3.4.
0 2 years, 7 months ago
I have the latest version of Stencyl, which is 3.4, and I can't find the ''self'' button. I think this Crash Course Game is outdated. I'm so MAD!!!
3 2 years, 8 months ago

Sign In to Comment