本文整理汇总了Python中ball.Ball.vRender方法的典型用法代码示例。如果您正苦于以下问题:Python Ball.vRender方法的具体用法?Python Ball.vRender怎么用?Python Ball.vRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ball.Ball
的用法示例。
在下文中一共展示了Ball.vRender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: game_stage_001
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import vRender [as 别名]
#.........这里部分代码省略.........
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()
else:
self.ship.vIdle()
if self.BlockMgr.countEnableBlocks() < 20 or self.BlockMgr.currentrow >= 13:
self.boss.Enable = True
if self.BlockMgr.countEnableBlocks() < 100 and self.BlockMgr.currentrow !=self.BlockMgr.maxrows:
self.BlockMgr.vMoveUp()
self.ship.vProcess(self.boss.bullet)
self.ball.vProcess(self.ship, self.boss, self.BlockMgr)
#self.ball.vProcess(self.ship, self.boss)
self.boss.vProcess(self.ball, self.ship)
if self.BlockMgr.vProcess(self.ball):
self.score += 100;
#Chance to create item
if self.ship.energy == 0 and not self.ball.Enable:
self.ship.state = "DEAD"
def vRender(self, _screen):
self.ship.vRender(_screen)
self.ball.vRender(_screen)
self.boss.vRender()
self.BlockMgr.vRender()
## self.allSprites.clear(_screen, self.background)
## self.allSprites.clear(_screen, self.text_surface)
_screen.blit(self.background,(0,0))
_screen.blit(self.text_surface,(790, 720))
_screen.blit(self.energy_text,(10, 720))
self.allSprites.draw(_screen)
_screen.blit(self.boss.image, self.boss.rect)
_screen.blit(self.Message, self.Message_rect)
pygame.display.flip()
def vDestroy(self):
pass
def vLoadBGM(self):
pass
def vMain(self, _screen):
self.vInit()
keepGoing = True
while keepGoing:
if self.state == "RUNNING":
self.vProcess()
elif self.state == "QUIT":
keepGoing = False
pygame.mixer.music.stop()
return 1
elif self.state == "GAME_OVER":
keepGoing = False
pygame.mixer.music.stop()
return 2
elif self.state == "END":
keepGoing = False
pygame.mixer.music.stop()
return 3
self.vRender(_screen)