How to create the Space Shooter game from scratch: a tutorial (part 3)

Modified: 2008/05/01 20:00 by SuzanneH - Uncategorized
This is the third part to the "how to create the Space Shooter game from scratch" tutorial. Click on one of the following links to view a different section:

Part 1
Part 2
Part 4

In this part of the tutorial you will make the enemy spacecraft move back and forth across the top of the scene and shoot on their own.

At this point you should be in the actors area of the game designer.

1. Click on the Flying Saucer actor from your actor list
2. Click on the Behavior button
3. Click on Motion to add a new motion behavior

You don’t need to change the event that triggers this motion. On load is selected by default, which means this motion will start as soon as the actor appears in the scene. (Which is right away.)

4. Click the Motion button for this behavior
5. Set the motion direction to be East (E)
6. Set the Continue Moving choice to be For Distance, and set that value to be 140
7. Select the Reverse When Done and Repeat Forever options
8. Click Preview to check that the back and forth motion of the enemy spacecraft is how you want it to be
9. Click the “x” button to exit the motion dialog

Image

Back and forth motion


Now you can add the shoot behavior. This needs to occur at a random time.

10. Click on the Shoot button to add a shoot behavior
11. Click on Event for the shoot behavior
12. Click on Timer
13. Select Random (go with the current default of every 5 to 20 seconds)
14. Click the “x” button to exit the event dialog

Image

Random event



























15. Click on the Projectile button for the shoot behavior
16. Select one of the projectiles from the dialog that appears (Fire Bullet works well) and then click the “x” button to exit the projectile chooser dialog
17. Click the Motion button for the shooting behavior
18. Set the Relative To setting to Scene
19. Select the South (S) motion for a downward motion
20. Click preview to see the movement and shooting in action. But wait! The enemy spaceships disappear when they collide with their own projectiles! This needs to be fixed. But first, finish this behavior by selecting a sound.

21. Click Sound to add a sound effect to your projectile when it fires (DotGun works nicely)
22. Click the “x” buttons to exit the dialogs until you are back at the actor editing area

Now you can fix it so the enemy spacecraft stop taking out their own spaceships every time they fire.

23. Select the projectile that is fired from the enemy spaceships, from your game’s actor list
24. Click the Behaviors button

Image

Bullet behaviors


You should see a DisappearOnCollision behavior in the list for this actor.

25. Click the Event button for the DisappearOnCollision behavior Instead of raising this event when the bullet (myself) collides with any solid, it should only occur when it hits the hero’s spaceship.
26. Click the Solids collidee button

Image

Collision event


27. Click the Any instance of this actor option
28. Set the actor to be the Fighter Spaceship (the hero’s spaceship)

Image

Colliding actor






















Don’t forget to save your game! You’re almost there.

In the final part of this tutorial, you'll hook up the won and lost scenes.

Click here to continue to part four of this tutorial

Privacy. Terms of Use. Trademarks.
ScrewTurn Wiki version 2.0.22. Some of the icons created by FamFamFam.