General Information
Getting the Ship to Move and Fire
Step 1 - Create Scene and Ship
- Create a blank Project
- Under the Project Info, change the name to Asteroids, the platform to GameSalad Arcade and give it a brief description
- Click on Scenes, double click on Initial Scene and change the name to Level 1
- Double Click on the Level 1 screen to open the scene
- In the inspector, click on the Scene button
- Under Attributes check the boxes next to Wrap X and Wrap Y
- Click on the Game button
- In the Library (the lower window), click on Images and drag the images you just downloaded into the project (keep in mind that they are white images on a clear background so you won’t see them, you’ll only see the names)
- In the Inspector, create a new actor and name it Ship
- In the inspector, double click on the ship, and set the following attributes: width 14, height 25
- Under the Motion section, set Max Speed to 600 and check Apply Max Speed
- Under the Physics section, set the Drag to 100
- In the library (the Images button should still be active) drag the Ship image on to the place where it says “Drag Image Here”
- On the top, click Scenes, Level 1, and drag the ship to the center of the stage
Step 2 – Getting the Ship to Rotate
- Double click on the ship on the stage to program the instance
- Click the lock and add a rule. Name the rule “Rotate Counter-Clockwise”
- Change Mouse Position to Key
- Click Keyboard and choose the Left button
- In the library, make sure Behaviors is selected, and drag Rotate onto the Add your behaviors here section
- Leave the direction as Counter Clockwise and change the speed to 300
- Copy this rule by holding down the ALT key and dragging the titlebar of the rule on to the blank part of the rules section
- Name the new rule “Rotate Clockwise”
- Click Keyboard and choose the Right button
- Change the direction to clockwise
- Test your game – the ship should rotate when you hold down either arrow key.
Step 3 – Getting the Ship to Move
- Click the back button to go back to the ship’s rules. Add a rule and name it “Move”
- Change Mouse Position to Key
- Click Keyboard and choose the Up button
- Drag an Accelerate behavior onto the rule and change its Direction to 90 and its Acceleration to 450. Make sure it stays Relative to Actor
- Add a Change Image behavior to this rule and set the image to shipmove
- Click the arrow next to the Otherwise section of this rule to open it. Drag another Change Image on this Otherwise section, but now set the image to ship
- Test your game
Step 4 – Getting the Ship to Fire
- Click Scenes, then Level 1. Create a new actor in the Inspector and call it Bullet
- Double click on the Bullet in the Inspector set both its width and height to 1
- Drag a Move rule onto the rules area and name it “Bullet Motion”. Change the speed to 600
- Drag a Timer on to the rules section and name it “Bullet End”.
- Change the “Every” to “After” and make it .5 second
- Drag a Destroy action on to the timer
- Click Scenes at the top, then Level 1, and then double click the ship on the stage
- Add a new rule and name it “Fire Bullet”
- Change Mouse Position to Key
- Click Keyboard and choose the Space button
- Drag a Spawn Actor on to this rule
- Change the actor to Bullet
- Change the direction to 90 and the position to 0 and 12
- Test your game
Last modified: Thursday, July 10, 2014, 8:08 AM