def enter(): # game world is prepared already in world_build_state global boy global twice_zombie boy = world_build_state.get_boy() twice_zombie = world_build_state.returnZombie pass
def enter(): # game world is prepared already in world_build_state global boy, boy_die, score boy_die = True boy = world_build_state.get_boy() pass
def enter(): # game world is prepared already in world_build_state global boy global zombies boy = world_build_state.get_boy() zombies = world_build_state.get_zombies() pass
def enter(): # game world is prepared already in world_build_state global boy boy = world_build_state.get_boy() global zombie zombie = world_build_state.get_zombie()
def enter(): # game world is prepared already in world_build_state global boy, zombies boy = world_build_state.get_boy() zombies = world_build_state.get_zombies() #RecordsInitialize() pass
def find_player(self): boy = world_build_state.get_boy() distance = (boy.x - self.x)**2 + (boy.y - self.y)**2 if distance < (PIXEL_PER_METER * 10)**2: self.dir = math.atan2(boy.y - self.y, boy.x - self.x) return BehaviorTree.SUCCESS else: self.speed = 0 return BehaviorTree.FAIL
def enter(): global rank with open('rank_data.json', 'rt') as f: rank = json.load(f) global boy boy = world_build_state.get_boy() pass
def enter(): # game world is prepared already in world_build_state global boy boy = world_build_state.get_boy() if ranking_state.rank is None: ranking_state.rank = ranking_state.ranking() with open('rank.json', 'r') as f: ranking_state.rank.data = json.load(f) pass
def find_player(self): boy = world_build_state.get_boy() distance = (boy.x - self.x)**2 + (boy.y - self.y)**2 if distance < (PIXEL_PER_METER * 10)**1.0: self.collide = True game_framework.push_state(rank_state) if distance < (PIXEL_PER_METER * 10)**2: self.dir = math.atan2(boy.y - self.y, boy.x - self.x) return BehaviorTree.SUCCESS else: self.speed = 0 return BehaviorTree.FAIL
def enter(): # game world is prepared already in world_build_state global boy boy = world_build_state.get_boy() pass
def enter(): global boy, zombie boy = world_build_state.get_boy() zombie = Zombie() pass
def enter(): # game world is prepared already in world_build_state global boy, zombie_list boy = world_build_state.get_boy() zombie_list = world_build_state.zombie_list
import random import math import game_framework from BehaviorTree import BehaviorTree, SelectorNode, SequenceNode, LeafNode from pico2d import * import world_build_state import ranking_state import game_world from boy import Boy boy = world_build_state.get_boy() # zombie Run Speed PIXEL_PER_METER = (10.0 / 0.3) # 10 pixel 30 cm RUN_SPEED_KMPH = 10.0 # Km / Hour RUN_SPEED_MPM = (RUN_SPEED_KMPH * 1000.0 / 60.0) RUN_SPEED_MPS = (RUN_SPEED_MPM / 60.0) RUN_SPEED_PPS = (RUN_SPEED_MPS * PIXEL_PER_METER) # zombie Action Speed TIME_PER_ACTION = 0.5 ACTION_PER_TIME = 1.0 / TIME_PER_ACTION FRAMES_PER_ACTION = 10 animation_names = ['Attack', 'Dead', 'Idle', 'Walk'] class Zombie: images = None font = None def load_images(self):
def enter(): global boy boy = world_build_state.get_boy() pass