本文整理汇总了Python中Game.Game.running方法的典型用法代码示例。如果您正苦于以下问题:Python Game.running方法的具体用法?Python Game.running怎么用?Python Game.running使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Game
的用法示例。
在下文中一共展示了Game.running方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import running [as 别名]
#!/usr/bin/python
import pygame
from Game import Game
from Constants import *
game = Game(WIDTH, HEIGHT, 0, "test")
game.createPlayer(PLAYER_W, PLAYER_H, 150, 150)
while( game.isRunning() ):
for event in pygame.event.get():
if event.type == pygame.QUIT:
game.running = False
game.update()
game.render()
示例2: int
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import running [as 别名]
jngl.setFontSize(20)
jngl.print("Press F1 for Help", 10, game.windowHeight-30)
if jngl.keyDown(jngl.key.F1):
jngl.draw(HELPSCREEN, (game.windowWidth/2)-jngl.getWidth(HELPSCREEN)/2, (game.windowHeight/2)-jngl.getHeight(HELPSCREEN)/2) #jngl.print(levels[level], int(445 - jngl.getTextWidth(levels[level]) / 2), 485)
jngl.print("www.somyeol.com", game.windowWidth-180, game.windowHeight-30)
jngl.swapBuffers()
jngl.translate(-jngl.getScreenWidth()/2, -jngl.getScreenHeight()/2)
#jngl.draw("img/World/canvas.png", self.windowWidth/2 - 137, self.windowHeight/2 - 92)
jngl.setFontSize(50)
needDraw = False
else:
jngl.sleep(1)
levelselect = False
if jngl.keyPressed(jngl.key.Return) and running:
jngl.setBackgroundColor(144, 187, 227)
game.running = True
game.levelpack = "{0}/".format(levels[level])
game.levelNr = selected
game.loadNextLevel()
## cProfile.run("game.run()")
game.run()
game.sound.stopSounds()
jngl.setBackgroundColor(0,0,0)
selected = 0
if not game.levelpack_finished:
levelselect=True
selected = game.levelNr-1
jngl.sleep(100)
#print levelselect
jngl.hideWindow()