本文整理汇总了Python中hero.Hero.update方法的典型用法代码示例。如果您正苦于以下问题:Python Hero.update方法的具体用法?Python Hero.update怎么用?Python Hero.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hero.Hero
的用法示例。
在下文中一共展示了Hero.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import update [as 别名]
def main():
open_canvas()
global mainback
mainback = Mainback()
global start
start = False
while(start == False):
handle_events()
clear_canvas()
mainback.draw()
update_canvas()
delay(0.08)
#클래스 선언
global hero
hero = Hero()
rabbit = Rabbit()
rabbit_group = [Rabbit() for i in range(600)]
land = Land()
wood = Wood()
global torch
torch = Torch()
global fire
fire = Fire()
eskimo = Eskimo()
attack_fire = Attack_fire()
attack_fire_group = [Attack_fire() for i in range(100)]
background = BackGround()
global ui
ui = Ui()
firewood = Firewood()
firewood_group = [Firewood() for i in range(600)]
#변수 선언
rabbit_group_counter = 0
rabbit_group_collision_counter = 0
attack_group_counter = 0
attack_group_update_counter = 0
attack_group_collision_counter = 0
rabbit_alive_counter = 0
attack_group_alive_check = False
attack_group_alive_counter = 0
attack_group_limit = 20
rabbit_group_draw_counter = 0
firewood_num_counter = 0
firewood_num_update_counter = 0
firewood_collide_counter = 0
rabbit_group_counter2 = 0
rabbit_jump = False
rabbit_num = 10
firewood_num = 10
rack_block = 0
eskimo_counter = 0
global running
running = True
while running:
#핸들 이벤트
handle_events()
#업데이트
hero.update()
background.update()
land.update()
wood.update()
fire.update()
torch.update()
eskimo.update()
ui.update(hero.x, hero.y, hero.ability)
for rabbit in rabbit_group: # 토끼 업데이트
if(rabbit_group_counter == rabbit_num):
rabbit_group_counter = 0
break
if(rabbit.alive):
rabbit.update()
rabbit_group_counter += 1
# for rabbit in rabbit_group: # 토끼 업데이트
# if(rabbit_group_counter2 == 1):
# print("%d" % rabbit.x)
# break
# rabbit_group_counter2 += 1
for attack_fire in attack_fire_group: # 공격불 업데이트
if(attack_group_update_counter == hero.attack_num):
attack_fire.init_direction()
attack_fire.alive = True # 공격불이 활성화 됨
attack_fire.init_fire()
attack_group_update_counter = 0
break
if(attack_fire.alive):
attack_fire.update()
attack_group_update_counter += 1
#.........这里部分代码省略.........