Beispiel #1
0
    def __init__(self, var_dict):
        LevelObject.__init__(self, var_dict)

        self.type = PLATFORM
        self.recipe_list = var_dict["recipe"]
        self.state = READY
        self.good_file = var_dict["good"]
        self.bad_file = var_dict["bad"]
        self.bad_anim = pyganim.PygAnimation([(os.path.join(self.bad_file), 1)])
        self.good_anim = pyganim.PygAnimation([(os.path.join(self.good_file), 1)])
Beispiel #2
0
 def __init__(self, var_dict):
     try:
         var_dict['file1'] = Part.lookup_image(var_dict['name'])
         var_dict['behavior0'] = 'pickup'
         LevelObject.__init__(self, var_dict)
         self.type = PART
         self.quality = var_dict['quality']
     except KeyError:
         print('invalid/missing keys sent to part __init__')
         raise KeyError
Beispiel #3
0
 def provide_type_vars(self):
     LevelObject.provide_type_vars(self)
     yield (self.name, 'xmin', str(self.xmin))
     yield (self.name, 'ymin', str(self.ymin))
     yield (self.name, 'xmax', str(self.xmax))
     yield self.name, 'ymax', str(self.ymax)
     yield (self.name, 'xhome', str(self.xhome))
     yield (self.name, 'yhome', str(self.yhome))
     yield (self.name, 'xspeed', str(self.xspeed))
     yield (self.name, 'yspeed', str(self.yspeed))
     yield (self.name, 'arm', self.arm.name)
Beispiel #4
0
 def __init__(self, var_dict):
     LevelObject.__init__(self, var_dict)
     self.type = BUILD_PROC
     str_input = var_dict['input']
     str_output = var_dict['output']
     self.input_items = [x.strip() for x in str_input.split(',')]
     self.output_items = [x.strip() for x in str_output.split(',')]
     self.length = to_num(var_dict['time'])
     self.delay_timer = Timer(5, self._ready)
     self.build_timer = Timer(self.length, self._finish)
     self.ready = True
     self.built = []  # list of output items that need to be spawned into the level
     self.input_area = self.rect  # required input parts must collide with this rect to start build
     self.output_area = pygame.Rect(self.rect.right, self.rect.bottom, 200, 100)  # items with output in this rect
Beispiel #5
0
    def __init__(self, var_dict):
        LevelObject.__init__(self, var_dict)

        self.type = CRANE_OBJECT

        #list of tuples representing coordinates and wait time ie dest[0] = (x,y,wait)
        #Contains coordinates and wait time for each destination
        self.dests = []
        self.cur_dest = 0
        self.arm = None
        self.arm_name = var_dict['arm']
        self.moving = False

        #These variables' values will be set in self.__setup_vars(var_dict)
        self.name = var_dict['name']
        self.xmin = var_dict['xmin']
        self.xmax = var_dict['xmax']
        self.ymin = var_dict['ymin']
        self.ymax = var_dict['ymax']
        self.xhome = var_dict['xhome']
        self.yhome = var_dict['yhome']
        self.xspeed = var_dict['xspeed']
        self.yspeed = var_dict['yspeed']

        #Create home destination
        self.add_dest(self.xhome, self.yhome, 500)
        self.add_dest(820, 250, 5000, PICKUP)
        self.add_dest(100, 250, 5000, PLACE)
        self._waiting = False
        self._power = False
        self.state = OFF

        #These x and y values represent the crane's position when telling it to move somewhere (claw)
        self.claw_x = 0
        self.claw_y = 0

        #Objects that are possible to pick up and held objects
        self.pos_pickup = []
        self.held_objects = []

        #Area of the crane that objects can be picked up from
        pickup_w = 60
        pickup_h = 30
        pickup_x = self.claw_x - pickup_w
        pickup_y = self.claw_y - pickup_h
        self.pickup_area = pygame.Rect(pickup_x, pickup_y, pickup_w, pickup_h)
Beispiel #6
0
 def provide_type_vars(self):
     LevelObject.provide_type_vars(self)
     yield ('input', str(self.input_items))
     yield ('output', str(self.output_items))
     yield ('time', str(self.length))
Beispiel #7
0
 def provide_type_vars(self):
     LevelObject.provide_type_vars(self)
     yield (self.name, "recipe", self.recipe_list)
     yield (self.name, "good", self.good_file)
     yield (self.name, "bad", self.bad_file)
Beispiel #8
0
 def collide(self, obj):
     LevelObject.collide(self, obj)
Beispiel #9
0
 def provide_type_vars(self):
     LevelObject.provide_type_vars(self)
     yield ('quality', self.quality)