def try_transform_miner_full(world, entity):
       new_entity = entities.MinerNotFull(
          entities.get_name(entity), entities.get_resource_limit(entity),
          entities.get_position(entity), entities.get_rate(entity),
          entities.get_images(entity), entities.get_animation_rate(entity))

       return new_entity
Exemple #2
0
 def save_background(self, file):
    for row in range(0, self.num_rows):
       for col in range(0, self.num_cols):
          file.write('background ' +
             entities.get_name(
                self.get_background(point.Point(col, row))) +
             ' ' + str(col) + ' ' + str(row) + '\n')
def save_background(world, file):
   for row in range(0, world.num_rows):
      for col in range(0, world.num_cols):
         file.write('background ' +
            entities.get_name(
               worldmodel.get_background(world, point.Point(col, row))) +
            ' ' + str(col) + ' ' + str(row) + '\n')
Exemple #4
0
def save_background(world, file):
   for row in range(0, world.num_rows):
      for col in range(0, world.num_cols):
         file.write('background ' +
            entities.get_name(
               worldmodel.get_background(world, point.Point(col, row))) +
            ' ' + str(col) + ' ' + str(row) + '\n')
def save_background(world, file): #Called from the function save_world which is not in a class
   for row in range(0, world.num_rows):
      for col in range(0, world.num_cols):
         file.write('background ' +
            entities.get_name(
               world.get_background(point.Point(col, row))) +
            ' ' + str(col) + ' ' + str(row) + '\n')
Exemple #6
0
    def try_transform_miner_full(world, entity):
        new_entity = entities.MinerNotFull(entities.get_name(entity),
                                           entities.get_resource_limit(entity),
                                           entities.get_position(entity),
                                           entities.get_rate(entity),
                                           entities.get_images(entity),
                                           entities.get_animation_rate(entity))

        return new_entity
 def try_transform_miner_not_full(world, entity):
     if entity.resource_count < entity.resource_limit:
        return entity
     else:
        new_entity = entities.MinerFull(
           entities.get_name(entity), entities.get_resource_limit(entity),
           entities.get_position(entity), entities.get_rate(entity),
           entities.get_images(entity), entities.get_animation_rate(entity))
        return new_entity
Exemple #8
0
 def try_transform_miner_not_full(world, entity):
     if entity.resource_count < entity.resource_limit:
         return entity
     else:
         new_entity = entities.MinerFull(
             entities.get_name(entity), entities.get_resource_limit(entity),
             entities.get_position(entity), entities.get_rate(entity),
             entities.get_images(entity),
             entities.get_animation_rate(entity))
         return new_entity
       def action(current_ticks):
          entities.remove_pending_action(entity, action)
          blob = world.create_blob(world, entities.get_name(entity) + " -- blob",
             entities.get_position(entity),
             entities.get_rate(entity),
             current_ticks, i_store)

          remove_entity(world, entity)
          add_entity(world, blob)

          return [entities.get_position(blob)]
   def action(current_ticks):
      entities.remove_pending_action(entity, action)
      blob = create_blob(world, entities.get_name(entity) + " -- blob",
         entities.get_position(entity),
         entities.get_rate(entity) // BLOB_RATE_SCALE,
         current_ticks, i_store)

      remove_entity(world, entity)
      worldmodel.add_entity(world, blob)

      return [entities.get_position(blob)]
Exemple #11
0
        def action(current_ticks):
            entities.remove_pending_action(entity, action)
            blob = world.create_blob(world,
                                     entities.get_name(entity) + " -- blob",
                                     entities.get_position(entity),
                                     entities.get_rate(entity), current_ticks,
                                     i_store)

            remove_entity(world, entity)
            add_entity(world, blob)

            return [entities.get_position(blob)]
    def action(current_ticks):
        entities.remove_pending_action(entity, action)
        blob = create_blob(world,
                           entities.get_name(entity) + " -- blob",
                           entities.get_position(entity),
                           entities.get_rate(entity) // BLOB_RATE_SCALE,
                           current_ticks, i_store)

        remove_entity(world, entity)
        worldmodel.add_entity(world, blob)

        return [entities.get_position(blob)]
Exemple #13
0
       def action(current_ticks):
          entities.remove_pending_action(entity, action)

          open_pt = world.find_open_around(world, entities.get_position(entity),
             entities.get_resource_distance(entity))
          if open_pt:
             ore = world.create_ore(world,
                "ore - " + entities.get_name(entity) + " - " + str(current_ticks),
                open_pt, current_ticks, i_store)
             add_entity(world, ore)
             tiles = [open_pt]
          else:
             tiles = []

          schedule_action(world, entity,
             world.create_vein_action(world, entity, i_store),
             current_ticks + entities.get_rate(entity))
          return tiles
    def action(current_ticks):
        entities.remove_pending_action(entity, action)

        open_pt = find_open_around(world, entities.get_position(entity),
                                   entities.get_resource_distance(entity))
        if open_pt:
            ore = create_ore(
                world, "ore - " + entities.get_name(entity) + " - " +
                str(current_ticks), open_pt, current_ticks, i_store)
            worldmodel.add_entity(world, ore)
            tiles = [open_pt]
        else:
            tiles = []

        schedule_action(world, entity,
                        create_vein_action(world, entity, i_store),
                        current_ticks + entities.get_rate(entity))
        return tiles