예제 #1
0
 def __init__(self, game):
     objects.RenderedNPC.__init__(self) #init NPC renderer
     self.g = game.g #store parameters
     self.game = game
     #load animations
     self.animator = animation.AnimationGroup(self.g, self, "objects/player/player_animation.xml")
     self.collidepoint = (16, 23) #set where to check for collisions
     self.size = (32, 32) #set sprite size
     self.tile_pos = self.g.save.get_prop("player", "pos", [5, 8]) #load current position
     self.game.set_obj_pos(self, self.tile_pos)
     self.pos = [((self.tile_pos[0]-1)*16)+8, (self.tile_pos[1]-1)*16] #set position in pixels
     self.rect = pygame.Rect(self.pos, self.size) #turn it into a rect
     self.move_direction = (0, 0) #we aren't moving in a particular direction
     self.direction = self.g.save.get_prop("player", "direction", 1) #load direction
     self.animator.set_animation("stand_"+get_direction_name(self.direction)) #set proper direction
     self.animator.update() #let it update
     self.moving = False #we aren't moving at all
     self.was_moving = False
     self.move_frames = 0 #amount of movement frames left
     self.in_water = False #whether we're currently walking in water
     self.notify_dlog = dialog.Dialog(self.g, "notify") #initialize a notify dialog
     self.move_manager = objects.MovementManager(self) #make a movement manager so we can be controlled in cutscenes
     self.party = self.g.save.get_prop("player", "pokemon", None) #load pokemon
     if self.party is None: #if none were loaded
         self.party = [pokemon.get_data("reuniclus").generate(5)] #make a new one
     else: #if they were
         t = self.party
         self.party = []
         for data in t: #load pokemon data
             p = pokemon.Pokemon() #make a new pokemon
             p.load(data) #load its saved data
             self.party.append(p) #add it to list of pokemon
예제 #2
0
 def set_enemy_mon(self, mon, level):
     self.enemy_mon = pokemon.get_data(mon).generate(
         level)  #create a trainers pokemon
     self.enemy_mon_anim = animation.PartAnimationSet(
         self.g, self.enemy_mon.data.anim_front)  #load its animation
     self.enemy_mon_anim.set_animation("demo")
     self.front_anim_ready = True
     self.next_task()
예제 #3
0
 def start_wild(self, type, level): #start a wild battle
     self.wild = True #this is a wild battle
     self.start_battle() #prepare battle
     self.enemy_mon = pokemon.get_data(type).generate(level) #create a new wild pokemon
     self.enemy_mon_anim = animation.PartAnimationSet(self.g, self.enemy_mon.data.anim_front) #load its animation
     self.enemy_mon_anim.set_animation("demo")
     self.front_anim_ready = True
     #initialize task list
     self.task_list = [[self.wait_transition, None], #wait for transition to complete
         [self.show_wild_mon, None], #show the wild pokemon appearing
         [self.wait_dialog, None], #wait for the dialog text to finish
         [self.draw_text, ("Go, " + self.player.activepokemon.show_name + "!{wait}{br}",)],
         [self.wait_dialog, None],
         [self.set_player_mon, None],
         [self.command_loop, None]] #start command loop
     self.next_task() #kick off task list
예제 #4
0
 def __init__(self, game):
     objects.RenderedNPC.__init__(self)  #init NPC renderer
     self.g = game.g  #store parameters
     self.game = game
     #load animations
     self.animator = animation.AnimationGroup(
         self.g, self, "objects/player/player_animation.xml")
     self.collidepoint = (16, 23)  #set where to check for collisions
     self.size = (32, 32)  #set sprite size
     self.tile_pos = self.g.save.get_prop("player", "pos",
                                          [5, 8])  #load current position
     self.game.set_obj_pos(self, self.tile_pos)
     self.pos = [((self.tile_pos[0] - 1) * 16) + 8,
                 (self.tile_pos[1] - 1) * 16]  #set position in pixels
     self.rect = pygame.Rect(self.pos, self.size)  #turn it into a rect
     self.move_direction = (0, 0
                            )  #we aren't moving in a particular direction
     self.direction = self.g.save.get_prop("player", "direction",
                                           1)  #load direction
     self.animator.set_animation(
         "stand_" +
         get_direction_name(self.direction))  #set proper direction
     self.animator.update()  #let it update
     self.moving = False  #we aren't moving at all
     self.was_moving = False
     self.move_frames = 0  #amount of movement frames left
     self.in_water = False  #whether we're currently walking in water
     self.notify_dlog = dialog.Dialog(self.g,
                                      "notify")  #initialize a notify dialog
     self.move_manager = objects.MovementManager(
         self
     )  #make a movement manager so we can be controlled in cutscenes
     self.party = self.g.save.get_prop("player", "pokemon",
                                       None)  #load pokemon
     if self.party is None:  #if none were loaded
         self.party = [pokemon.get_data("reuniclus").generate(5)
                       ]  #make a new one
     else:  #if they were
         t = self.party
         self.party = []
         for data in t:  #load pokemon data
             p = pokemon.Pokemon()  #make a new pokemon
             p.load(data)  #load its saved data
             self.party.append(p)  #add it to list of pokemon
예제 #5
0
 def start_wild(self, type, level):  #start a wild battle
     self.wild = True  #this is a wild battle
     self.start_battle()  #prepare battle
     self.enemy_mon = pokemon.get_data(type).generate(
         level)  #create a new wild pokemon
     self.enemy_mon_anim = animation.PartAnimationSet(
         self.g, self.enemy_mon.data.anim_front)  #load its animation
     self.enemy_mon_anim.set_animation("demo")
     self.front_anim_ready = True
     #initialize task list
     self.task_list = [
         [self.wait_transition, None],  #wait for transition to complete
         [self.show_wild_mon, None],  #show the wild pokemon appearing
         [self.wait_dialog, None],  #wait for the dialog text to finish
         [
             self.draw_text,
             ("Go, " + self.player.activepokemon.show_name +
              "!{wait}{br}", )
         ],
         [self.wait_dialog, None],
         [self.set_player_mon, None],
         [self.command_loop, None]
     ]  #start command loop
     self.next_task()  #kick off task list
예제 #6
0
 def set_enemy_mon(self, mon, level):
     self.enemy_mon = pokemon.get_data(mon).generate(level) #create a trainers pokemon
     self.enemy_mon_anim = animation.PartAnimationSet(self.g, self.enemy_mon.data.anim_front) #load its animation
     self.enemy_mon_anim.set_animation("demo")
     self.front_anim_ready = True
     self.next_task()