示例#1
0
文件: game.py 项目: grisevg/RayCastPy
class Game:
    #Constants

    #Properties
    world = None
    player = None
    display = None
    controls = None
    clock = None
    is_running = False
    fps = -1



    def __init__(self):
        self.world = World()
        self.display = Display()
        self.controls = Controls()
        self.clock = Clock()
        self.fps = -1
        #self.is_running = False ?

    def init(self):
        self.display.initWindow()
        self.world.loadTextWorld('sample')
        self.display.initMinimap(self.world)
        self.player = Player(Vector(self.world.starting_point)+0.5)


    def startLoop(self):
        time_to_exit = False
        while not time_to_exit:
            self.clock.tick(30)
            self.fps = self.clock.get_fps()
            keys = self.controls.getInput()
            self.player.move(self.world, keys)
            self.display.draw(self)
            time_to_exit = keys[self.controls.ESCAPE]

    def close(self):
        self.display.close()
示例#2
0
文件: game.py 项目: grisevg/RayCastPy
 def __init__(self):
     self.world = World()
     self.display = Display()
     self.controls = Controls()
     self.clock = Clock()
     self.fps = -1