Created
August 10, 2009 22:55
-
-
Save naengwen/165479 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This doesn't really do anything outside of post a text label at the lower left hand corner of #the screen right now. | |
from pyglet import window | |
from pyglet import font | |
#We has a hundred Eych Peeez | |
hp = 100 | |
class GameWindow (window.Window): | |
def __init__(self, *args, **kwargs): | |
#Standard arguments are passed to window here | |
window.Window.__init__(self, *args, **kwargs) | |
def game_loop(self): | |
#Font that will be used for status | |
status_font = font.load('Arial',28) | |
#At some point in the future this will keep track of something useful! | |
hp_text = font.Text(status_font, y=10) | |
#here's the loop | |
while not self.has_exit: | |
self.dispatch_events() | |
self.clear() | |
#Useful stat is checked | |
hp_text.text = ("Health: %d") % (hp) | |
hp_text.draw() | |
self.flip() | |
if __name__ == "__main__": | |
#when someone launches this directly | |
game = GameWindow() | |
game.game_loop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment