From 819d1666fa228d195b9f70b2192385dd407d875d Mon Sep 17 00:00:00 2001 From: pnjiwsfv3 <3147226574@qq.com> Date: Sat, 1 Jun 2024 23:25:23 +0800 Subject: [PATCH] ADD file via upload --- bullet.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bullet.py diff --git a/bullet.py b/bullet.py new file mode 100644 index 0000000..a41264d --- /dev/null +++ b/bullet.py @@ -0,0 +1,14 @@ +from dinosaur import * + +class Bullet: + def __init__(self, game_speed, dinosaur): + self.game_speed = game_speed + self.image = BULLET + self.rect = self.image.get_rect() + self.rect.x = dinosaur.dino_rect.x + dinosaur.dino_rect[2] + 10 + self.rect.y = dinosaur.dino_rect.y + dinosaur.dino_rect[3] / 2 + + def update(self): + self.rect.x += self.game_speed + def draw(self,SCREEN): + SCREEN.blit(self.image, (self.rect.x, self.rect.y)) \ No newline at end of file