|
|
@ -1,8 +1,8 @@ |
|
|
|
import pygame |
|
|
|
import pygame |
|
|
|
from beings import * |
|
|
|
#from beings import * |
|
|
|
from settings import timesurf_image |
|
|
|
from settings import timesurf_image |
|
|
|
|
|
|
|
|
|
|
|
class Surface: |
|
|
|
class BuffRandomSurf: |
|
|
|
def __init__(self,surf_x,surf_y): |
|
|
|
def __init__(self,surf_x,surf_y): |
|
|
|
self.x = surf_x |
|
|
|
self.x = surf_x |
|
|
|
self.y = surf_y |
|
|
|
self.y = surf_y |
|
|
@ -12,6 +12,11 @@ class Surface: |
|
|
|
self.rect = pygame.Rect(self.x,self.y,self.width,self.height,) |
|
|
|
self.rect = pygame.Rect(self.x,self.y,self.width,self.height,) |
|
|
|
def place(self,window,surf_x,surf_y): |
|
|
|
def place(self,window,surf_x,surf_y): |
|
|
|
pygame.draw.rect(window,self.color,self.rect) |
|
|
|
pygame.draw.rect(window,self.color,self.rect) |
|
|
|
|
|
|
|
def collide(self,object): |
|
|
|
|
|
|
|
if self.rect.colliderect(object): |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
class SlowTimeSurf: |
|
|
|
class SlowTimeSurf: |
|
|
|
def __init__(self,surf_x,surf_y): |
|
|
|
def __init__(self,surf_x,surf_y): |
|
|
@ -22,7 +27,7 @@ class SlowTimeSurf: |
|
|
|
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.switch = True |
|
|
|
self.activation_timer = 500 |
|
|
|
self.activation_timer = 1000 |
|
|
|
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])) |
|
|
@ -31,3 +36,14 @@ class SlowTimeSurf: |
|
|
|
return True |
|
|
|
return True |
|
|
|
else: |
|
|
|
else: |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
def activate(self,enemy): |
|
|
|
|
|
|
|
if self.activation_timer > 0: |
|
|
|
|
|
|
|
self.activation_timer -= 1 |
|
|
|
|
|
|
|
if enemy.vel <= 1: |
|
|
|
|
|
|
|
enemy.bul_cooldown += 0.5//enemy.vel #- 1 |
|
|
|
|
|
|
|
if 0.3 <= enemy.vel: |
|
|
|
|
|
|
|
enemy.vel -= 0.03 |
|
|
|
|
|
|
|
if self.activation_timer <= 500 and enemy.vel <= 3: |
|
|
|
|
|
|
|
enemy.vel += 0.043 |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
enemy.vel = 3 |
|
|
|