Added background image

This commit is contained in:
Marcin Kostrzewski 2019-01-29 18:28:52 +01:00
parent 56803f3dfb
commit d3ad2c310b
2 changed files with 0 additions and 16 deletions

View File

@ -44,10 +44,6 @@ def draw_debug_text():
screen.blit(text, (0,count*12)) screen.blit(text, (0,count*12))
count+=1 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") bg, bg_rect=load_img("bg.png")
# game loop # game loop

View File

@ -20,10 +20,6 @@ def load_sound(name):
sound=pygame.mixer.Sound(sound_path) sound=pygame.mixer.Sound(sound_path)
return sound return sound
# timer
clock=pygame.time.Clock()
# sprite groups # sprite groups
all_sprites=pygame.sprite.Group() all_sprites=pygame.sprite.Group()
@ -105,7 +101,6 @@ class Bullet(pygame.sprite.Sprite):
self.rect.center=(x, y) self.rect.center=(x, y)
self.speed=vec(0, 0) self.speed=vec(0, 0)
self.direction=direction self.direction=direction
self.clock=pygame.time.Clock()
def shoot(self): def shoot(self):
if self.direction==0: if self.direction==0:
@ -122,10 +117,3 @@ class Bullet(pygame.sprite.Sprite):
self.shoot() self.shoot()
if self.rect.bottom<0 or self.rect.right<0 or self.rect.left>WINDOW_WIDTH or self.rect.top>WINDOW_HEIGHT: if self.rect.bottom<0 or self.rect.right<0 or self.rect.left>WINDOW_WIDTH or self.rect.top>WINDOW_HEIGHT:
self.kill() 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)