From 4050057c34c67130cf5f1d202ca85cb81985f968 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sat, 16 Mar 2024 22:05:05 +0200 Subject: make it installable --- src/sliceitoff/main.py | 49 ++++++++----------------------------------------- 1 file changed, 8 insertions(+), 41 deletions(-) (limited to 'src/sliceitoff/main.py') diff --git a/src/sliceitoff/main.py b/src/sliceitoff/main.py index 529fcaa..58cc617 100644 --- a/src/sliceitoff/main.py +++ b/src/sliceitoff/main.py @@ -1,44 +1,11 @@ -import pygame - -from time import sleep - -from display import Display -from status import Status -from player import Player -from field import Field -from enemies import Enemies -from images import Images -from game import Game - +""" main.py """ +from runpy import run_path +from pathlib import Path def main(): - pygame.init() - - display = Display() - Images.load_images() - - status = Status() - field = Field() - enemies = Enemies(field = field, level = 2) - player = Player(field = field, enemies = enemies) - game = Game(player=player) - - clock = pygame.time.Clock() - - for _ in range(6000): - if game.step(): - break - display.update( - [ - status.get_sprites(), - field.get_sprites(), - enemies.get_sprites(), - player.get_sprites() - ]) - clock.tick(60) - - - sleep(2) - pygame.quit() + """ Let's start the app as current path being base """ + my_path = Path(__file__).parent.resolve() + run_path(f"{my_path}", run_name="sliceitoff") -main() +if __name__ == "__main__": + main() -- cgit v1.2.3