tangledmind/main.py

53 lines
1.3 KiB
Python
Raw Normal View History

2020-03-28 03:43:12 +01:00
# -*- coding: UTF-8 -*-
### Tangled Mind
### Author: Arthur 'Grizzly' Grisel-Davy
import pygame
2020-05-02 05:34:46 +02:00
from models import Game, Player, Carte, Camera, Enemy, Hud
2020-04-11 06:17:49 +02:00
2020-03-28 03:43:12 +01:00
pygame.init()
screen_width = 1200
2020-03-28 03:43:12 +01:00
screen_height = 800
2020-04-15 01:07:57 +02:00
center_screen = (int(screen_width/2),int(screen_height/2))
2020-03-28 03:43:12 +01:00
screen = pygame.display.set_mode((screen_width, screen_height))
done = False
2020-04-04 06:11:34 +02:00
BACKGROUND=(200,200,200)
2020-03-28 03:43:12 +01:00
WHITE=(255,255,255)
BLUE=(0,0,255)
RED=(255,0,0)
2020-03-28 03:43:12 +01:00
2020-04-29 17:18:34 +02:00
carte = Carte('map1')
2020-05-01 03:28:51 +02:00
# possible positions: 300,300: 1400,1000: 2700,400, 2800,1600
2020-04-29 16:34:28 +02:00
# click = 323
2020-05-02 05:34:46 +02:00
player = Player('Alice',660,1570,center_screen,pygame.K_z,pygame.K_s,pygame.K_q,pygame.K_d,323,'perso.png','canon.png','projectile1_right.png')
2020-04-28 22:40:40 +02:00
camera = Camera(660,1570,screen_width,screen_height,0.3)
2020-05-01 03:28:51 +02:00
enemies = [Enemy('Plop',(300,300),'perso.png')]
2020-05-02 05:34:46 +02:00
hud = Hud(player)
game = Game(carte,player,camera,enemies,hud)
2020-03-28 03:43:12 +01:00
2020-04-11 06:17:49 +02:00
clock = pygame.time.Clock()
2020-03-28 03:43:12 +01:00
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
2020-04-11 06:17:49 +02:00
2020-04-14 02:43:09 +02:00
keystate = pygame.key.get_pressed() + pygame.mouse.get_pressed()
2020-05-02 05:34:46 +02:00
player.check_keys(keystate,screen_width,screen_height,carte,camera)
2020-03-28 03:43:12 +01:00
screen.fill(BACKGROUND)
2020-04-15 01:07:57 +02:00
game.draw(screen)
2020-04-11 06:17:49 +02:00
pygame.display.flip()
2020-04-12 06:08:24 +02:00
clock.tick(60)
2020-04-11 06:17:49 +02:00