|
|
@ -1,7 +1,7 @@ |
|
|
|
import pygame |
|
|
|
import pygame |
|
|
|
import pygame_menu |
|
|
|
import pygame_menu |
|
|
|
import sys |
|
|
|
import sys |
|
|
|
from settings import windowX,windowY, DEBUG, window_caption,logo,gamefont |
|
|
|
from settings import windowX,windowY, DEBUG, window_caption,logo,gamefont, FPS |
|
|
|
from bullets import Bullet |
|
|
|
from bullets import Bullet |
|
|
|
from beings import * |
|
|
|
from beings import * |
|
|
|
from surfaces import SlowTimeSurf, BuffRandomSurf |
|
|
|
from surfaces import SlowTimeSurf, BuffRandomSurf |
|
|
@ -15,7 +15,8 @@ font = pygame.font.Font(gamefont, 46) |
|
|
|
|
|
|
|
|
|
|
|
################################################################ |
|
|
|
################################################################ |
|
|
|
def play(): |
|
|
|
def play(): |
|
|
|
FPS = 70 |
|
|
|
if DEBUG == True: |
|
|
|
|
|
|
|
from bullets import player_bullets_on_screen,enemy_bul_on_screen |
|
|
|
clock = pygame.time.Clock() |
|
|
|
clock = pygame.time.Clock() |
|
|
|
pygame.mouse.set_visible(False) |
|
|
|
pygame.mouse.set_visible(False) |
|
|
|
slowsurf = SlowTimeSurf(384,64) |
|
|
|
slowsurf = SlowTimeSurf(384,64) |
|
|
@ -26,7 +27,9 @@ def play(): |
|
|
|
enemies_on_screen.append(enemy2) |
|
|
|
enemies_on_screen.append(enemy2) |
|
|
|
print(enemies_on_screen) |
|
|
|
print(enemies_on_screen) |
|
|
|
player = Player() |
|
|
|
player = Player() |
|
|
|
death_timer = 70 |
|
|
|
|
|
|
|
|
|
|
|
death_timer = 1.5 |
|
|
|
|
|
|
|
death_timer_calculation = (death_timer/70)/death_timer |
|
|
|
SCORE = 0 |
|
|
|
SCORE = 0 |
|
|
|
########################## LAYER 0 |
|
|
|
########################## LAYER 0 |
|
|
|
while True: |
|
|
|
while True: |
|
|
@ -43,6 +46,8 @@ def play(): |
|
|
|
pygame.draw.rect(window,(184, 227, 179, 1),(row,0,2,windowY)) |
|
|
|
pygame.draw.rect(window,(184, 227, 179, 1),(row,0,2,windowY)) |
|
|
|
for column in range(0,windowY,64): |
|
|
|
for column in range(0,windowY,64): |
|
|
|
pygame.draw.rect(window,(184, 227, 179),(0,column,windowX,2)) |
|
|
|
pygame.draw.rect(window,(184, 227, 179),(0,column,windowX,2)) |
|
|
|
|
|
|
|
#print('power_of_random: ',player.power_of_random) |
|
|
|
|
|
|
|
print('bullets_on_screen: ', str(len(player_bullets_on_screen + enemy_bul_on_screen))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########################## LAYER 0 END |
|
|
|
########################## LAYER 0 END |
|
|
@ -51,7 +56,7 @@ def play(): |
|
|
|
if slowsurf.switch == True: |
|
|
|
if slowsurf.switch == True: |
|
|
|
slowsurf.place(window) |
|
|
|
slowsurf.place(window) |
|
|
|
if slowsurf.collide(player.player_rect): |
|
|
|
if slowsurf.collide(player.player_rect): |
|
|
|
print("Colliding !") |
|
|
|
print("<Sakuya slows the flow of time !>") |
|
|
|
slowsurf.switch = False |
|
|
|
slowsurf.switch = False |
|
|
|
else: |
|
|
|
else: |
|
|
|
#for enemy in enemies_on_screen: #Doesn`t work and I don`t know why |
|
|
|
#for enemy in enemies_on_screen: #Doesn`t work and I don`t know why |
|
|
@ -61,7 +66,7 @@ def play(): |
|
|
|
if randsurf.switch == True: |
|
|
|
if randsurf.switch == True: |
|
|
|
randsurf.place(window) |
|
|
|
randsurf.place(window) |
|
|
|
if randsurf.collide(player.player_rect): |
|
|
|
if randsurf.collide(player.player_rect): |
|
|
|
print('Random !!!') |
|
|
|
print('<Randoumu no pawa~ !>') |
|
|
|
randsurf.switch = False |
|
|
|
randsurf.switch = False |
|
|
|
else: |
|
|
|
else: |
|
|
|
randsurf.activate(player) |
|
|
|
randsurf.activate(player) |
|
|
@ -75,15 +80,19 @@ def play(): |
|
|
|
player.collision(window) |
|
|
|
player.collision(window) |
|
|
|
|
|
|
|
|
|
|
|
if player.out_of_area(): |
|
|
|
if player.out_of_area(): |
|
|
|
death_timer -= 1 |
|
|
|
death_timer -= death_timer_calculation |
|
|
|
timertext_color = (255-death_timer-60,3.6*death_timer,10) |
|
|
|
timertext_color = (255-death_timer*150,170*death_timer,10) |
|
|
|
text = font.render(str(death_timer), True, timertext_color) |
|
|
|
text = font.render(str(round(death_timer,2)), True, timertext_color) |
|
|
|
window.blit(text,(windowX//2,windowY//2 - 100)) |
|
|
|
window.blit(text,(windowX//2,windowY//2 - 100)) |
|
|
|
if death_timer <= 1: |
|
|
|
if death_timer < 0.1: |
|
|
|
print('DED') |
|
|
|
print('DED') |
|
|
|
|
|
|
|
if DEBUG == True: |
|
|
|
|
|
|
|
print('TOTAL {}'.format(time.time()-start)) |
|
|
|
break |
|
|
|
break |
|
|
|
else: |
|
|
|
else: |
|
|
|
death_timer = 70 |
|
|
|
if DEBUG == True: |
|
|
|
|
|
|
|
start = time.time() |
|
|
|
|
|
|
|
death_timer = 1.5 |
|
|
|
|
|
|
|
|
|
|
|
########################## LAYER 1 END |
|
|
|
########################## LAYER 1 END |
|
|
|
|
|
|
|
|
|
|
@ -115,14 +124,6 @@ def play(): |
|
|
|
print('Win-win') |
|
|
|
print('Win-win') |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
# for enemy in enemies_on_screen: |
|
|
|
|
|
|
|
# if enemy[0].alive == True: |
|
|
|
|
|
|
|
# enemy[0].move('right') |
|
|
|
|
|
|
|
# enemy[0].enemy_shoot(window) |
|
|
|
|
|
|
|
# enemy[0].draw(window) |
|
|
|
|
|
|
|
# enemy[0].collision(window) |
|
|
|
|
|
|
|
# else: |
|
|
|
|
|
|
|
# enemy[0].draw(window) |
|
|
|
|
|
|
|
########################## LAYER 2 END |
|
|
|
########################## LAYER 2 END |
|
|
|
|
|
|
|
|
|
|
|
########################## LAYER 3 |
|
|
|
########################## LAYER 3 |
|
|
|