Browse Source

SlowTimesurf working properly now

master
Unbewohnte 4 years ago
parent
commit
3c3e02dcec
  1. 21
      Main.py
  2. 2
      surfaces.py

21
Main.py

@ -44,14 +44,21 @@ def play():
########################## LAYER 0 END ########################## LAYER 0 END
########################## LAYER 1 ########################## LAYER 1
slowsurf.place(window) if slowsurf.switch == True:
if slowsurf.collide(player.player_rect): slowsurf.place(window)
enemy.vel -= 0.1 if slowsurf.collide(player.player_rect):
enemy2.vel -= 0.1 print("Colliding !")
print("Colliding !") slowsurf.switch = False
else: else:
enemy.vel = 3 if slowsurf.timer >= 0:
enemy2.vel = 3 slowsurf.timer -= 1
enemy.vel = 3 - 2
enemy2.vel = 3 - 2
enemy.bul_cooldown += 1.5
enemy2.bul_cooldown += 1.5
else:
enemy.vel = 3
enemy2.vel = 3
player.teleportation() player.teleportation()
player.shoot(window) player.shoot(window)

2
surfaces.py

@ -21,6 +21,8 @@ class SlowTimeSurf:
self.height = 64 self.height = 64
self.color = (0,0,0) self.color = (0,0,0)
self.rect = pygame.Rect(self.x, self.y, self.width, self.height) self.rect = pygame.Rect(self.x, self.y, self.width, self.height)
self.switch = True
self.timer = 500
def place(self,window): def place(self,window):
pygame.draw.rect(window,self.color,self.rect) pygame.draw.rect(window,self.color,self.rect)
window.blit(timesurf_image,(self.rect[0], self.rect[1])) window.blit(timesurf_image,(self.rect[0], self.rect[1]))

Loading…
Cancel
Save