本文整理汇总了Python中ball.Ball.vSetPos方法的典型用法代码示例。如果您正苦于以下问题:Python Ball.vSetPos方法的具体用法?Python Ball.vSetPos怎么用?Python Ball.vSetPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ball.Ball
的用法示例。
在下文中一共展示了Ball.vSetPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: game_stage_001
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import vSetPos [as 别名]
#.........这里部分代码省略.........
return
elif self.msg == "YOU WIN":
self.state = "END"
return
self.Message_rect.center = (self.Message_rect.center[0]+18, self.Message_rect.center[1])
if self.ship.state == "DEAD" and self.ship.frame == len(self.ship.imageDead)-1:
self.msg = "GAME OVER"
self.Message = self.bigfont.render("",True,( 255, 255, 255))
self.Message_rect.center = (512, 382)
if self.boss.life <= 0 and self.boss.state == "DEAD_LEFT":
self.msg = "YOU WIN"
self.Message = self.bigfont.render("",True,( 255, 255, 255))
self.Message_rect.center = (512, 382)
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type == KEYDOWN :
#print pygame.key.name(275)
if event.key == 276:
self.space_dir = "LEFT"
self.mouse_move = False
elif event.key == 275:
self.space_dir = "RIGHT"
self.mouse_move = False
elif event.key == K_SPACE:
if self.ball.Enable == False:
self.ship.energy -= 1
#self.ball.Enable = True
self.ball.vSetPos(self.ship.rect[0]+(self.ship.rect[2]/2), self.ship.rect[1]+self.ship.rect[3]+(self.ship.rect[3]/2))
## elif event.key == K_UP:
## self.BlockMgr.vMoveUp()
elif event.type == KEYUP:
self.space_dir = "IDLE"
if event.key == K_q:
self.state = "QUIT"
return
elif event.type == MOUSEMOTION:
self.mouse_pos = event.pos
self.mouse_move = True
elif event.type == MOUSEBUTTONDOWN:
if self.ball.Enable == False:
self.ship.energy -= 1
#self.ball.Enable = True
self.ball.vSetPos(self.ship.rect[0]+(self.ship.rect[2]/2), self.ship.rect[1]+self.ship.rect[3]+(self.ship.rect[3]/2))
else:
self.space_dir = "IDLE"
#print self.ball.rect
if self.space_dir == "LEFT" :
self.ship.vMoveLeft()
elif self.space_dir == "RIGHT":
self.ship.vMoveRight()
elif self.mouse_move == True:
if self.mouse_pos[0] < self.ship.fGetPos()[0]:
self.ship.vMoveLeft()
if self.mouse_pos[0] > self.ship.fGetPos()[0]:
self.ship.vMoveRight()
if self.mouse_pos[0] == self.ship.fGetPos()[0]:
self.mouse_move = False
self.ship.vIdle()