Abstract
In Space Rocks, the player controls a spaceship, whose goal is to fly around and shoot lasers to destroy asteroids that are floating across the screen. The player must also take care that the spaceship does not get hit by asteroids, as they can damage or destroy the spaceship.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This control scheme has a significant difference from the control scheme from the previous game. In Space Rocks, the control scheme is relative to the character’s (in this case, the spaceship’s) viewpoint. In contrast, the Starfish Collector game featured a control scheme that was relative to the player’s viewpoint. For example, pressing the up arrow key moved the turtle toward the top of the screen, regardless of what direction the turtle was facing. Using a control scheme relative to the character can provide a more immersive gameplay experience for the player.
- 2.
This assumes your game is running at a rate of 60 frames per second (FPS), which should be the case for nearly all computers running this program. For more complicated games involving large amounts of high-resolution graphics and complicated code, the rate at which the program runs could be slower, and you would need to take the possibility into account when writing the event. This issue will be discussed at length in future chapters.
- 3.
Since acceleration represents the change in velocity, the units for the rate of acceleration are pixels per second. If the rate of acceleration is 100, this means that during every second the velocity will increase by 100 pixels per second.
- 4.
If you had instead selected the condition On Key Down, the condition would be true for as long as the spacebar is being held down and would result in a continuous stream of laser fire. For the Space Rocks game, using this condition would make the game too easy, but this is a cool effect to keep in mind for other games you might make in the future.
- 5.
You may wonder why you don’t simply set the initial visibility of the Explosion object to invisible, as you did for the Fire object. This is because, if you set this explosion instance to be invisible by default, then all the explosions that will be spawned later will also be invisible by default, and you would have to include an extra action to make them visible after they are created. Dragging the initial explosion off-screen is an easy way to avoid this extra code.
- 6.
In a future chapter, you will learn a more common approach to this problem: how create a customized property, called an instance variable, which can be used to store this information.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2017 Lee Stemkoski and Evan Leider
About this chapter
Cite this chapter
Stemkoski, L., Leider, E. (2017). Space Rocks. In: Game Development with Construct 2. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2784-8_3
Download citation
DOI: https://doi.org/10.1007/978-1-4842-2784-8_3
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-2783-1
Online ISBN: 978-1-4842-2784-8
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books