My OOP practice project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.3 KiB

4 years ago
import pygame
import pygame_menu
import sys
4 years ago
from bullets import Bullet
from beings import *
from surfaces import Surface
from particles import *
4 years ago
######## Set up things that will not change
4 years ago
pygame.init()
pygame.display.set_caption('Healthless')
windowX = 832
windowY = 832
4 years ago
window = pygame.display.set_mode((windowX,windowY))
icon = pygame.image.load('pics/logo.png')
pygame.display.set_icon(icon)
font = pygame.font.Font('freesansbold.ttf', 46)
4 years ago
########
4 years ago
4 years ago
################################################################
4 years ago
def play():
4 years ago
FPS = 70
clock = pygame.time.Clock()
pygame.mouse.set_visible(False)
enemy = Enemy()
player = Player()
4 years ago
death_timer = 70
##########################
4 years ago
while True:
4 years ago
for event in pygame.event.get():
if event.type == pygame.QUIT:
gamerun = False
pygame.quit(),sys.exit()
break
window.fill((41, 64, 59))
##########################
4 years ago
#PPPPPPPPPPPPPPPPPPPPPPPPP
player.teleportation()
player.shoot(window)
player.draw(window)
player.update()
player.collision(window)
4 years ago
if player.out_of_area():
death_timer -= 1
timertext_color = (255-death_timer-60,3.6*death_timer,10)
text = font.render(str(death_timer), True, timertext_color)
window.blit(text,(windowX//2,windowY//2 - 100))
if death_timer <= 1:
4 years ago
print('DED')
break
else:
death_timer = 70
#PPPPPPPPPPPPPPPPPPPPPPPPP
4 years ago
#EEEEEEEEEEEEEEEEEEEEEEEEE
enemy.enemy_shoot(window)
enemy.draw(window)
4 years ago
enemy.move('right')
4 years ago
if enemy.enemy_x >= windowX-10: #That returning thingy
enemy.enemy_x = 5
enemy.collision(window)
4 years ago
if enemy.out_of_area():
print('Random is on our side')
4 years ago
break
#EEEEEEEEEEEEEEEEEEEEEEEEE
4 years ago
4 years ago
clock.tick(FPS)
4 years ago
pygame.display.update()
4 years ago
pass
4 years ago
##################################################################
4 years ago
def quit():
pygame_menu.events.EXIT
sys.exit()
4 years ago
while True:
4 years ago
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit(),sys.exit()
break
menu = pygame_menu.Menu(windowX,windowY,'Healthless',theme = pygame_menu.themes.THEME_BLUE)
menu.add_button('Play', play)
menu.add_button('Quit', quit)
menu.mainloop(window)