From d3ad2c310b28f95b5f750a3758b4ecca3af88cce Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Tue, 29 Jan 2019 18:28:52 +0100 Subject: [PATCH] Added background image --- mygame.py | 4 ---- sprites.py | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/mygame.py b/mygame.py index 2a452f7..ff25448 100644 --- a/mygame.py +++ b/mygame.py @@ -44,10 +44,6 @@ def draw_debug_text(): screen.blit(text, (0,count*12)) count+=1 -# set hitbox objects as screen boundaries ### DEBUG ### -boundary=pygame.sprite.Group() -boundary.add=Hitbox(int(WINDOW_WIDTH/2), 0, WINDOW_WIDTH, 10) - bg, bg_rect=load_img("bg.png") # game loop diff --git a/sprites.py b/sprites.py index 187320f..8df3689 100644 --- a/sprites.py +++ b/sprites.py @@ -20,10 +20,6 @@ def load_sound(name): sound=pygame.mixer.Sound(sound_path) return sound -# timer - -clock=pygame.time.Clock() - # sprite groups all_sprites=pygame.sprite.Group() @@ -105,7 +101,6 @@ class Bullet(pygame.sprite.Sprite): self.rect.center=(x, y) self.speed=vec(0, 0) self.direction=direction - self.clock=pygame.time.Clock() def shoot(self): if self.direction==0: @@ -122,10 +117,3 @@ class Bullet(pygame.sprite.Sprite): self.shoot() if self.rect.bottom<0 or self.rect.right<0 or self.rect.left>WINDOW_WIDTH or self.rect.top>WINDOW_HEIGHT: self.kill() - -class Hitbox(pygame.sprite.Sprite): - def __init__(self, x, y, w, h): - self.size=pygame.Surface((x,y)) - self.rect=self.size.get_rect() - self.rect.center=vec(x,y) - print(self.rect.center) \ No newline at end of file