Nov-09-2019, 01:33 AM
(This post was last modified: Nov-09-2019, 01:33 AM by allusernametaken.)
Hello, python world.
I'm studying python using the book called 'Python Crash Course'.
There's a portion of the book making a game using Pygame and I'm at the part to code bullet module for a ship to fire a bullet.
Here's a bit of the codes I'm confused about.
Why minus? the bullet's starting position is at the bottom and it's supposed to go up along the y-axis. what am i missing?
I'm studying python using the book called 'Python Crash Course'.
There's a portion of the book making a game using Pygame and I'm at the part to code bullet module for a ship to fire a bullet.
Here's a bit of the codes I'm confused about.
def __init__(self, ai_game): --snip-- # Create a bullet rect at (0, 0) and then set correct position. self.rect = pygame.Rect(0, 0, self.settings.bullet_width, self.settings.bullet_height) self.rect.midtop = ai_game.ship.rect.midtop --snip-- def update(self): """Move the bullet up the screen.""" # Update the decimal position of the bullet. self.y -= self.settings.bullet_speedand, the last line "self.y -= self.settings.bullet_speed",
Why minus? the bullet's starting position is at the bottom and it's supposed to go up along the y-axis. what am i missing?