Return to repo list

heart-of-gold

Tactical RPG written in python, using pygame.
Return to HMagellan.com

commit 25261b72ae1bd12bcf18856d0cd014738033100a
parent 1e823bb064e0a73a733a969a2e64245e72f00ec9
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Wed, 19 Aug 2020 09:10:02 -0500

basic skeleton

Diffstat:
Amain.py | 8++++++++
Asrc/game.py | 34++++++++++++++++++++++++++++++++++
Asrc/init.py | 0
3 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/main.py b/main.py @@ -0,0 +1,8 @@ +import pygame +from src import game + +pygame.init() + +if __name__ == "__main__": + g1 = game.Game() + g1.mainloop() diff --git a/src/game.py b/src/game.py @@ -0,0 +1,34 @@ +import pygame + +class Game(object): + + def __init__(self): + + self.screen = pygame.display.set_mode((1024, 768)) + self.frame_clock = pygame.time.Clock() + self.framerate = 60 + self.on = True + + def shift_frames(self, framerate): + + self.frame_clock.tick(framerate) + + def handle_events(self): + + for event in pygame.event.get(): + if event.type == pygame.QUIT: + self.on = False + + def update_game(self): + + self.screen.fill((0, 0, 0)) + pygame.display.update() + + def mainloop(self): + + while self.on: + self.shift_frames(self.framerate) + self.handle_events() + self.update_game() + + pygame.quit() diff --git a/src/init.py b/src/init.py