|
|
|
@ -7,6 +7,7 @@ import pygame
|
|
|
|
|
import yaml
|
|
|
|
|
|
|
|
|
|
from models import Game, Player, Carte, Camera, Enemy, Hud
|
|
|
|
|
from utils import enemy_placement
|
|
|
|
|
|
|
|
|
|
pygame.init()
|
|
|
|
|
|
|
|
|
@ -22,26 +23,29 @@ WHITE=(255,255,255)
|
|
|
|
|
BLUE=(0,0,255)
|
|
|
|
|
RED=(255,0,0)
|
|
|
|
|
|
|
|
|
|
# with open(r'./config.yaml') as file:
|
|
|
|
|
# data = yaml.load(file,Loader=yaml.FullLoader)
|
|
|
|
|
# up = pygame.key.key_code(data['up'])
|
|
|
|
|
# right = pygame.key.key_code(data['right'])
|
|
|
|
|
# down = pygame.key.key_code(data['down'])
|
|
|
|
|
# left = pygame.key.key_code(data['left'])
|
|
|
|
|
# pause = pygame.key.key_code(data['pause'])
|
|
|
|
|
# print(up,right,down,left,pause)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with open(r'./config.yaml') as file:
|
|
|
|
|
data = yaml.load(file,Loader=yaml.FullLoader)
|
|
|
|
|
path_player = data['path_player']
|
|
|
|
|
path_canon = data['path_canon']
|
|
|
|
|
path_enemy = data['path_enemy']
|
|
|
|
|
path_projectile = data['path_projectile']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
carte = Carte(n=5)
|
|
|
|
|
|
|
|
|
|
enemies = []
|
|
|
|
|
for positions in enemy_placement(carte.carte):
|
|
|
|
|
for position in positions:
|
|
|
|
|
enemies.append(Enemy('Plop',position,path_enemy))
|
|
|
|
|
|
|
|
|
|
start_pos = carte.player_start_pos
|
|
|
|
|
player = Player('Alice',start_pos,center_screen,pygame.K_z,pygame.K_s,pygame.K_q,pygame.K_d,323,'perso.png','canon.png','projectile1_right.png')
|
|
|
|
|
player = Player('Alice',start_pos,center_screen,pygame.K_z,pygame.K_s,pygame.K_q,pygame.K_d,323,path_player,path_canon,path_projectile)
|
|
|
|
|
camera = Camera(start_pos,screen_width,screen_height,0.3)
|
|
|
|
|
#enemies = [Enemy('Plop',(300,300),'perso.png')]
|
|
|
|
|
hud = Hud(player)
|
|
|
|
|
game = Game(carte,player,camera,[],hud)
|
|
|
|
|
game = Game(carte,player,camera,enemies,hud)
|
|
|
|
|
|
|
|
|
|
clock = pygame.time.Clock()
|
|
|
|
|
|
|
|
|
|