Steps for Creating the SpaceShip:
1. Draw a SpaceShip. Make sure you point the ship to the right. Make two costumes, one with flames and one without.
Option: You may use one of these images for your Space Ship:
2. Create the following Variables: (For This Sprite Only)
3. We need to create three event Scripts ("Up Arrow", "Right Arrow", and "Left Arrow")
4. Drag a "when Space Key pressed" and a "repeat until" into the Ship Script Area and change to "Up Arrow."
5. Put a green operator "not " into the repeat until.
6. Go to sensing and put a "key up arrow pressed" into the "not " block.
7. Put a "next costume" in the repeat until.
8. Put three "change DirectionChange" blocks into the repeat until.
Change the variables to "Thrust," "NewX," "NewY."
9. Put a value of "0.1" in the change Thrust Block
10. Drag two "multiplication" operators into the script area.
11. Put the Variable "Thrust" into the multiplication blocks.
12. Put "sqrt " block into each multiplication block.
13. Change one of the "sqrt " blocks to "sin"
14. Change the other "sqrt" block to "cos"
15. Put the Thrust * sin block into the change NewX block
16. Put the Thrust * cos block into the change NewY block
17. Go to motion blocks and put a blue direction block into the sin and cos blocks.
18. Put a "switch to costume NoFlames" underneath the repeat until.
19. Put a "set Thrust to 0" under the "switch costume."
20. Now that we have finished the "Up Arrow" Scripts - we need to do the "right" and "left" arrow scripts.
21. Put the following Blocks for "right arrow"
22. Put the following Blocks for "left arrow"
23. Up, Right, and Left represent the User controls for the Ship.
However, the ship will not move until we put the "Action" code for the computer to take the commands ,and data and translate it to movement.
24. Use the following Green Flag script to move the ship around the screen:
25. Add this Green Flag script to reset the variables and allow the ship to "Pass Through" the edges of the screen:
26. Click the Green flag and test your ship!
Steps for Creating the "Ray"
27. We want the "Ray" to travel to a Target - and then stop traveling when it hits a target. We also want the Ray to go back to the Ship and Hide when not being fired.
28. Click "Create New Sprite" and draw a "Ray"
29. Create the following Variables for "Ray"
30. Put the following blocks for a Green Flag event for "Ray" (This allows the Ray to travel a set distance and check its status (fire or not fired)
31. Put these scripts to allow the Ray to "Pass Through" the edges:
32. Use these Scripts for the "Space Key" event:
33. We will use a "When I Receive" to allow the ray to know when it has hit a target
Scripts for Landing Pad Game
34. Add the Variable "Gravity" to the Ship. Make sure it is "for this sprite only."
35. Find the Green Flag Script for the Ship that allows it to "Pass Through" the edge of the screen. Remove the if statements containing the "y" values.
36. The Gravity value will pull the ship towards the "ground." So we will change the Green Flag script that controls the ship's position by subtracting "Gravity" from the y position and increasing "Gravity" by 0.05 each cycle.
37. Add a new Green Flag Script that sets all the values to 0 when the ship's y is less than -175 (at the bottom of the screen) or if touching the red of the landing pad.
38. At the start of the game we want the ship to find a new starting position and orientation. So, add the following Green Flag script.
39. We now need to modify the "up arrow" event to compare "Gravity" to "NewY." We will check to see if the two values are within 2. If they are - we will reset both to 0. This keeps Gravity and NewY from getting too large. Modify the "Up arrow" Script in this way:
40. Create a New Sprite to be the Landing Pad. I chose to make the platform red and have the ship check to see if it is touching the red for a proper landing. Position the Landing Pad at the bottom of the screen. I also drew a "moon" surface sprite.
41. Add these scripts to the Landing Pad so the Pad changes position each time the game starts.
42. Here are some Scripts for using a We-Do Tilt controller and a gimbal.
43. Save and test! Try adding more challenges like having the landing pad move about so the ship has to touch a moving target.