summaryrefslogtreecommitdiff
path: root/src/sliceitoff/__main__.py
blob: 5fc766bab538551fb487c6f2d85d0328b83ab7d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
""" Slice It Off! - Game where you slice the area where enemies reside to
    the minimum
"""

from time import sleep
from pathlib import Path

import pygame

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


def sliceitoff():
    """ The game - It all starts here """
    pygame.init()

    display = Display()
    Images.load_images( Path(__file__).parent.resolve() )

    status = Status()
    field = Field()
    enemies = Enemies(field = field, level = 10)
    player = Player(field = field, enemies = enemies)
    game = Game(player = player)

    clock = pygame.time.Clock()
    

    while True:
        
        dt = clock.tick(60)
        for fun in (status, field):
            fun.update(dt)
        
        display.update(
                [
                    status.sprites,
                    field.sprites,
                    enemies.get_sprites(),
                    player.get_sprites()
                ])

        if game.step():
            break

    sleep(2)
    pygame.quit()

sliceitoff()