本文整理汇总了Python中ship.Ship.resetSprt方法的典型用法代码示例。如果您正苦于以下问题:Python Ship.resetSprt方法的具体用法?Python Ship.resetSprt怎么用?Python Ship.resetSprt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ship.Ship
的用法示例。
在下文中一共展示了Ship.resetSprt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import resetSprt [as 别名]
def main():
WINSIZE = 640,480
NUMBER_OF_STARS = 250
STARTING_ANGLE = 180
CLOSEST_STAR_COLOR = (255, 255, 255)
STAR_SIZE_IN_PIXELS = 1
#_V_ = 1
pygame.init()
pygame.key.set_repeat(1,1)
screen = pygame.display.set_mode(WINSIZE,pygame.SWSURFACE)
stars = Starfield(screen,screen.get_rect(),NUMBER_OF_STARS,STARTING_ANGLE,(40,4),STAR_SIZE_IN_PIXELS,CLOSEST_STAR_COLOR)
ship1 = Ship(screen)
done = False
while not done:
screen.fill(THECOLORS["black"])
stars.update()
ship1.draw()
ship1.resetSprt()
pygame.display.update()
events = pygame.event.get()
for e in events:
if(e.type == QUIT):
done = True
break
elif (e.type == KEYDOWN):
if(e.key == K_ESCAPE):
done = True
break
#Test for movement
dx,dy = 0,0
if(e.key == K_DOWN):
dy += 1
if(e.key == K_UP):
dy -= 1
if(e.key == K_LEFT):
dx -= 1
if(e.key == K_RIGHT):
dx += 1
ship1.move(dx,dy)
#if(e.key == K_PLUS):
#stars.set_speed((
print "Exiting!"
return