重构
This commit is contained in:
parent
0db90ba8c8
commit
0345119d34
@ -340,7 +340,7 @@ class MoveCard():
|
||||
|
||||
def checkMouseClick(self, mouse_pos):
|
||||
x, y = mouse_pos
|
||||
if(x >= self.rect.x and x <= self.rect.right and
|
||||
if (x >= self.rect.x and x <= self.rect.right and
|
||||
y >= self.rect.y and y <= self.rect.bottom):
|
||||
return True
|
||||
return False
|
||||
@ -425,7 +425,7 @@ class MoveBar():
|
||||
|
||||
def checkMenuBarClick(self, mouse_pos):
|
||||
x, y = mouse_pos
|
||||
if(x >= self.rect.x and x <= self.rect.right and
|
||||
if (x >= self.rect.x and x <= self.rect.right and
|
||||
y >= self.rect.y and y <= self.rect.bottom):
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -211,7 +211,7 @@ class StarBullet(Bullet):
|
||||
or (self.rect.y > c.SCREEN_HEIGHT) or (self.rect.y < 0)):
|
||||
self.kill()
|
||||
elif self.state == c.EXPLODE:
|
||||
if (self.current_time - self.explode_timer) > 250:
|
||||
if (self.current_time - self.explode_timer) >= 250:
|
||||
self.kill()
|
||||
|
||||
# 这里用的是坚果保龄球的代码改一下,实现子弹换行
|
||||
@ -220,7 +220,6 @@ class StarBullet(Bullet):
|
||||
_, map_y1 = self.level.map.getMapIndex(self.rect.x, self.rect.centery + 40)
|
||||
else:
|
||||
_, map_y1 = self.level.map.getMapIndex(self.rect.x, self.rect.centery + 20)
|
||||
# _, map_y2 = self.level.map.getMapIndex(self.rect.x, self.rect.bottom +20)
|
||||
if (self.map_y != map_y1) and (0 <= map_y1 <= self.level.map_y_len-1): # 换行
|
||||
self.level.bullet_groups[self.map_y].remove(self)
|
||||
self.level.bullet_groups[map_y1].add(self)
|
||||
|
||||
@ -581,7 +581,7 @@ class Level(tool.State):
|
||||
# 检查小菜单有没有被点击
|
||||
def checkLittleMenuClick(self, mouse_pos):
|
||||
x, y = mouse_pos
|
||||
if(x >= self.little_menu_rect.x and x <= self.little_menu_rect.right and
|
||||
if (x >= self.little_menu_rect.x and x <= self.little_menu_rect.right and
|
||||
y >= self.little_menu_rect.y and y <= self.little_menu_rect.bottom):
|
||||
return True
|
||||
return False
|
||||
@ -589,7 +589,7 @@ class Level(tool.State):
|
||||
# 检查小菜单的返回有没有被点击
|
||||
def checkReturnClick(self, mouse_pos):
|
||||
x, y = mouse_pos
|
||||
if(x >= self.return_button_rect.x and x <= self.return_button_rect.right and
|
||||
if (x >= self.return_button_rect.x and x <= self.return_button_rect.right and
|
||||
y >= self.return_button_rect.y and y <= self.return_button_rect.bottom):
|
||||
return True
|
||||
return False
|
||||
@ -597,7 +597,7 @@ class Level(tool.State):
|
||||
# 检查小菜单的重新开始有没有被点击
|
||||
def checkRestartClick(self, mouse_pos):
|
||||
x, y = mouse_pos
|
||||
if(x >= self.restart_button_rect.x and x <= self.restart_button_rect.right and
|
||||
if (x >= self.restart_button_rect.x and x <= self.restart_button_rect.right and
|
||||
y >= self.restart_button_rect.y and y <= self.restart_button_rect.bottom):
|
||||
return True
|
||||
return False
|
||||
@ -605,7 +605,7 @@ class Level(tool.State):
|
||||
# 检查小菜单的主菜单有没有被点击
|
||||
def checkMainMenuClick(self, mouse_pos):
|
||||
x, y = mouse_pos
|
||||
if(x >= self.mainMenu_button_rect.x and x <= self.mainMenu_button_rect.right and
|
||||
if (x >= self.mainMenu_button_rect.x and x <= self.mainMenu_button_rect.right and
|
||||
y >= self.mainMenu_button_rect.y and y <= self.mainMenu_button_rect.bottom):
|
||||
return True
|
||||
return False
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user