Skip to content

Instantly share code, notes, and snippets.

from __future__ import division
from random import uniform
from pyglet import clock, font, image, window
from pyglet.gl import *
class Entity(object):
def __init__(self, id, size, x, y, rot):
self.id = id
#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):
#!/usr/bin/env python
# Here's something by Mark Mruss demonstrating a basic Python game using Pyglet. I figure this
# might be a good place to start as a reference, since there's already a main loop and several
# classes set up. Quick warning: need to provide images for the program to work properly.
# If something other than that doesn't work, or doesn't make sense, let me know.
# PyGletSpace - An Example game using PyGlet
# Copyright (C) 2007 Mark Mruss <selsine@gmail.com>
# http://www.learningpython.com
#! /usr/bin/env python
"""Here's the test harness.
@TODO: Figure out collision events for jumps, etc.
"""
try:
import os
import sys
import math
import random
import pymunk