本文整理汇总了Python中cocos.cocosnode.CocosNode.remove方法的典型用法代码示例。如果您正苦于以下问题:Python CocosNode.remove方法的具体用法?Python CocosNode.remove怎么用?Python CocosNode.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos.cocosnode.CocosNode
的用法示例。
在下文中一共展示了CocosNode.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Wobble
# 需要导入模块: from cocos.cocosnode import CocosNode [as 别名]
# 或者: from cocos.cocosnode.CocosNode import remove [as 别名]
#.........这里部分代码省略.........
if(tile and self.tile_types[tile.id]):
type = self.tile_types[tile.id]
return type
def char_left_tile_type(self):
posY = self.char.y
if(self.facing == "down"):
posY = self.char.y + 50
posX = self.char.x - 40
return self.grid_type_at_pixel(posX, posY)
def char_right_tile_type(self):
posY = self.char.y
if(self.facing == "down"):
posY = self.char.y + 50
# else:
# posY = self.char.y + 75
posX = self.char.x + 40
return self.grid_type_at_pixel(posX, posY)
def char_ground_tile_type(self):
if(self.facing == "up"):
posY = self.char.y -25
else:
posY = self.char.y + 75
return self.grid_type_at_pixel(self.char.x, posY)
def set_animation(self,name=None):
if(name == None):
name = self.status
if(self.sprite != self.animations[name]):
if(self.sprite):
self.char.remove(self.sprite)
self.sprite = self.animations[name]
self.char.add(self.sprite)
self.sprite.opacity = 210
# self.sprite.color = (255,0,0)
self.sprite.x = 0
self.sprite.y = 0
def char_jump_block(self):
delta = 1
if(self.facing == "down"):
delta = -1
x,y = self.char_to_grid()
while self.grid_type(x,y) == 'air' and y > -2 and y < 15 :
y += delta
return y
def step(self, dt):
kb = self.keyboard
if(self.status != 'death'):
if self.char.x <= self.parent.manager.fx - 375:
self.die()
return
my_tile = self.char_to_grid()
my_tile_type = self.grid_type(my_tile[0],my_tile[1])
ground_tile_type = self.char_ground_tile_type()
if(ground_tile_type == "bad" or my_tile_type == "bad"):
self.die()
elif(ground_tile_type == "air"):