Space Mixed Practice
| # | Answer |
|---|---|
| 1 | A variable is a named place to store data. In a space game, it could store the spaceship's fuel level so the program can change it as the ship moves. |
| 2 | planetName |
| 3 | Float or decimal number |
| 4 | if countdown == 0 then launch rocket |
| 5 | A loop repeats code. Example: repeating a star animation across the screen. |
| 6 | for count from 5 down to 1: display count |
| 7 | Keyboard input |
| 8 | It stores multiple related items, such as a list of planets, astronaut names, or collected minerals. |
| 9 | Example: [Mercury, Venus, Mars] |
| 10 | It might test for liquid water, a suitable temperature, or breathable atmosphere. |
| 11 | A sprite is a moving object such as a rocket or alien. A background is the scene behind it, such as stars or a planet surface. |
| 12 | fuel >= requiredFuel |
| 13 | It gives bonus points when the score is greater than 100. |
| 14 | calculateGravity |
| 15 | A function helps reuse code, organize the program, and avoid repeating the same steps. |
| 16 | function collectMeteor(): score = score + 10 |
| 17 | Selection, such as if/else or switch/case. |
| 18 | if key == left move left, else if key == right move right, else if key == up move up, else if key == down move down |
| 19 | Debugging is finding and fixing errors in code. |
| 20 | thrust |
| 21 | Usually to the right. |
| 22 | x >= 0 and x <= screenWidth and y >= 0 and y <= screenHeight |
| 23 | Fuel should decrease over time because the ship uses fuel while traveling. |
| 24 | Every 3 seconds: create asteroid |
| 25 | An algorithm is a step-by-step set of instructions. For a rocket: check fuel, start engines, count down, and launch. |
| 26 | A loop is shorter, easier to update, and reduces repeated code. |
| 27 | while not at exit: move according to controls |
| 28 | As a message, text string, number readings, or a data object with fields like temperature and location. |
| 29 | if crystalsCollected == totalCrystals and atBase then win |
| 30 | set score, fuel, and position; read input; move ship; check for collisions; update score and fuel; if health is 0 or mission complete then game over |