Spaces:
Configuration error
Configuration error
Download classes/bullets.py from warhawkmonk/the_game: direct link, hf CLI and curl.
- Browser
- Download file 620 Bytes
-
https://huggingface.co/spaces/warhawkmonk/the_game/resolve/main/classes/bullets.py
- Command line
-
hf download hf://spaces/warhawkmonk/the_game/classes/bullets.py
-
curl -L -o bullets.py https://huggingface.co/spaces/warhawkmonk/the_game/resolve/main/classes/bullets.py
620 Bytes
| import pygame | |
| class Bullet(pygame.sprite.Sprite): | |
| def __init__(self, x, y): | |
| super().__init__() | |
| self.image = pygame.image.load('images/bullets/bullet1.png').convert_alpha() | |
| self.rect = self.image.get_rect() | |
| self.rect.centerx = x | |
| self.rect.bottom = y - 10 | |
| self.speed = 10 | |
| self.shoot_sound = pygame.mixer.Sound('game_sounds/shooting/shoot.mp3') | |
| self.shoot_sound.set_volume(0.4) | |
| self.shoot_sound.play() | |
| def update(self): | |
| self.rect.move_ip(0, -self.speed) | |
| if self.rect.top <= 1: | |
| self.kill() | |