From 3d1e8a068f98a32e0146d8e9ab58dea49fbb4c74 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sat, 16 Mar 2024 15:11:12 +0200 Subject: controls and gamelogic draft --- src/sliceitoff/main.py | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'src/sliceitoff/main.py') diff --git a/src/sliceitoff/main.py b/src/sliceitoff/main.py index d4fb0bc..1e84d28 100644 --- a/src/sliceitoff/main.py +++ b/src/sliceitoff/main.py @@ -1,33 +1,41 @@ -from pygame import ( - init as pg_init, - quit as pg_quit) +import pygame from time import sleep from display import Display from status import Status +from player import Player from field import Field from images import Images +from game import Game + def main(): - pg_init() + pygame.init() display = Display() Images.load_images() status = Status() field = Field() - - field.slice(20_000, 20_000, True, 1_000) - field.slice(10_000, 20_000, False, 1_000) + player = Player(field = field) + game = Game(player=player) - display.update( - [ - status.get_sprites(), - field.get_sprites() - ]) + clock = pygame.time.Clock() + + for _ in range(600): + if game.step(): + break + display.update( + [ + status.get_sprites(), + field.get_sprites(), + player.get_sprites() + ]) + clock.tick(60) + sleep(2) - pg_quit() + pygame.quit() main() -- cgit v1.2.3