def __init__(self): super(Jump, self).__init__() self.barriers = [] self.barrier = [] self.playing = False self.score = 0 self.game = dkl.Game(660, 600, "Jump") self.load = dkl.TextureDataLoader() self.load.loadList([{'name': 'bird', 'path': './bird'}]) self.create() self.create_bird() self.create_barrier() self.start() self.game.run()
def __init__(self): self.game = dkl.Game(800, 600, "Test") self.create() self.game.run()
def __init__(self): self.game = dkl.Game(800, 600, "Collision Detection") self.create() self.game.run()
150, 150, fillStyle=dkl.Color.ORANGE, strokeStyle=dkl.Color.ORANGE_RED, lineWidth=3) layer2.addEventListener(dkl.MouseEvent.MOUSE_DOWN, onClick) game.stage.addChild(layer2) # blue layer layer3 = dkl.Sprite() layer3.mouseShelter = False layer3.x = 300 layer3.y = 100 layer3.name = "Blue Layer" layer3.graphics.drawRect(0, 0, 150, 150, fillStyle=dkl.Color.fromHex("#00BFFF"), strokeStyle=dkl.Color.fromHex("#4169E1"), lineWidth=3) layer3.addEventListener(dkl.MouseEvent.MOUSE_DOWN, onClick) layer3.addEventListener(dkl.MouseEvent.MOUSE_MOVE, onMouseMove) game.stage.addChild(layer3) if __name__ == "__main__": game = dkl.Game(570, 450, "Mouse Event Demo") demoInit() game.run()
def __init__(self): self.game = dkl.Game(800, 600, "Get Fruit") self.loadRes() self.create() self.game.run()