
Episode 96: How Computers Work Part VI - High Level Programming and Software
The Science of Everything Podcast
00:00
How to Program a Spaceship Shooting Game Using a Key Binding Event
You can fire by pressing space bar. The enemy ships come from the top of the screen and move down towards the player. And if they collide with the player youou'll lose a life. So that's the game that we want to try an code. We caun then define a variable controlling the vertical and horizontal positions of the player ship, and set up a key binding event so that whenever one of the arokees is pressed, the values defining the Vertical and Horizontal positions are increased or decreased appropriately. Now, we'll also need a way of showing the bullets that i'm firing at the enemy ships. I could either create those objects when the space bar is pressed, so
Transcript
Play full episode