Chapter 21We Like to Move It
Our game is starting to look like, well, a game. The only problem is that the cars are just sitting there, not moving at all. In this chapter we’ll change that.
Moving the Enemy
We now have a game screen with a road background and an enemy car that appears at random locations along the top of the screen. Now we’ll make the enemy move.
As you will recall, the enemy is driving toward you (going the right way—and you are the one driving the wrong way!). To make the enemy move, we simply need to move the sprite down the screen.
How fast will the enemy move? That’s up to you. If it moves 1 pixel at a time, it’ll move ...
Get Captain Code: Unleash Your Coding Superpower with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.