|
|
@ -6,7 +6,6 @@ import time |
|
|
|
from bullets import Bullet |
|
|
|
from bullets import Bullet |
|
|
|
from beings import * |
|
|
|
from beings import * |
|
|
|
from surfaces import Surface |
|
|
|
from surfaces import Surface |
|
|
|
|
|
|
|
|
|
|
|
######## Set up things that will not change |
|
|
|
######## Set up things that will not change |
|
|
|
pygame.init() |
|
|
|
pygame.init() |
|
|
|
pygame.display.set_caption('Healthless') |
|
|
|
pygame.display.set_caption('Healthless') |
|
|
@ -16,6 +15,8 @@ window = pygame.display.set_mode((windowX,windowY)) |
|
|
|
icon = pygame.image.load('pics/logo.png') |
|
|
|
icon = pygame.image.load('pics/logo.png') |
|
|
|
pygame.display.set_icon(icon) |
|
|
|
pygame.display.set_icon(icon) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# font = pygame.font.Font('freesansbold.ttf', 32) |
|
|
|
|
|
|
|
# text = font.render('5', True,(100,100,100)) |
|
|
|
|
|
|
|
|
|
|
|
bullet_image = pygame.image.load('pics/second_bullet.png') |
|
|
|
bullet_image = pygame.image.load('pics/second_bullet.png') |
|
|
|
enemy_bul_img = pygame.image.load('pics/bullet.png') |
|
|
|
enemy_bul_img = pygame.image.load('pics/bullet.png') |
|
|
@ -31,7 +32,9 @@ def play(): |
|
|
|
pygame.mouse.set_visible(False) |
|
|
|
pygame.mouse.set_visible(False) |
|
|
|
enemy = Enemy() |
|
|
|
enemy = Enemy() |
|
|
|
player = Player() |
|
|
|
player = Player() |
|
|
|
test_surface = Surface() |
|
|
|
death_timer = 70 |
|
|
|
|
|
|
|
# lower_surface = Surface('killsurf') |
|
|
|
|
|
|
|
# main_surface = Surface('default') |
|
|
|
|
|
|
|
|
|
|
|
while True: |
|
|
|
while True: |
|
|
|
for event in pygame.event.get(): |
|
|
|
for event in pygame.event.get(): |
|
|
@ -42,29 +45,37 @@ def play(): |
|
|
|
|
|
|
|
|
|
|
|
window.fill((41, 64, 59)) # (41,64,59) |
|
|
|
window.fill((41, 64, 59)) # (41,64,59) |
|
|
|
|
|
|
|
|
|
|
|
test_surface.place(window,100,100) |
|
|
|
# lower_surface.place(window,0,0) |
|
|
|
|
|
|
|
# main_surface.place(window,145,145) |
|
|
|
|
|
|
|
|
|
|
|
player.teleportation() |
|
|
|
player.teleportation() |
|
|
|
player.shoot(window,start_color,bullet_image) |
|
|
|
player.shoot(window,start_color,bullet_image) |
|
|
|
player.draw(window,start_color,player_image) |
|
|
|
player.draw(window,start_color,player_image) |
|
|
|
player.update(window,start_color,bullet_image) |
|
|
|
player.update(window,start_color,bullet_image) |
|
|
|
player.collision() |
|
|
|
player.collision() |
|
|
|
|
|
|
|
if player.out_of_area(): |
|
|
|
|
|
|
|
death_timer -= 1 |
|
|
|
|
|
|
|
print('death_timer',death_timer) |
|
|
|
|
|
|
|
if death_timer <= 0: |
|
|
|
|
|
|
|
print('DED') |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
death_timer = 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enemy.enemy_shoot(window,start_color,enemy_bul_img) |
|
|
|
enemy.enemy_shoot(window,start_color,enemy_bul_img) |
|
|
|
enemy.draw(window,start_color,enemy_image) |
|
|
|
enemy.draw(window,start_color,enemy_image) |
|
|
|
enemy.move('right') |
|
|
|
enemy.move('right') |
|
|
|
|
|
|
|
|
|
|
|
if enemy.enemy_x == windowX: |
|
|
|
if enemy.enemy_x == windowX: |
|
|
|
enemy.enemy_x = 1 |
|
|
|
enemy.enemy_x = 1 |
|
|
|
enemy.collision() |
|
|
|
enemy.collision() |
|
|
|
|
|
|
|
|
|
|
|
if player.out_of_area(): |
|
|
|
|
|
|
|
print(player.x, player.y) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if enemy.out_of_area(): |
|
|
|
if enemy.out_of_area(): |
|
|
|
print('Random is on our side') |
|
|
|
print('Random is on our side') |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clock.tick(FPS) |
|
|
|
clock.tick(FPS) |
|
|
|
pygame.display.update() |
|
|
|
pygame.display.update() |
|
|
|
pass |
|
|
|
pass |
|
|
|