concept ship in category python

This is an excerpt from Manning's book Hello! Python.
The following listing shows the start of your Ship class. You’ll be adding features to it through the rest of this section. I’ve included this class in the same file as the planet, but feel free to create a new file and import it.
First, you load the image for your ship
, in the same way you did for the planet. Your Ship class looks similar to Planet, but you have some extra information
: .dx and .dy are the ship’s speed in the x and y directions, and .rotation is how far left or right you’ve turned. You also put in .thrust and .rot_spd to determine how fast the ship should accelerate and turn. The higher these numbers are, the faster the ship will go.
Now you can create an instance of your ship
. You feed in the ship’s speed here as dx and dy, but it won’t have any effect until you start updating the ship’s position in the next section.
Finally, it looks a bit odd for your ship to be flying around without any visual feedback, so I created an extra image with some flames shooting out of the back. You swap it over whenever the ship’s engines are on
.
, in the same way you did for the planet. Your Ship class looks similar to Planet, but you have some extra information
: .dx and .dy are the ship’s speed in the x and y directions, and .rotation is how far left or right you’ve turned. You also put in .thrust and .rot_spd to determine how fast the ship should accelerate and turn. The higher these numbers are, the faster the ship will go.
. You feed in the ship’s speed here as dx and dy, but it won’t have any effect until you start updating the ship’s position in the next section.