Example #1
0
def load_weapon(filename) :
   w = Weapon()
   buf = open(filename, 'r').read().replace('\n', '')
   w.turn_point[0] = fp.read_named_float(buf, "turn_point_x=")
   w.turn_point[1] = fp.read_named_float(buf, "turn_point_y=")
   w.shot_timer.set_interval(fp.read_named_float(buf, "reload_time="))
   w.shot_timer.start()
   load_game_object(buf, w)
   w.shot = load_shot(fp.read_named_string(buf, "shot=", "'"))
   w.sound = sl.load(fp.read_named_string(buf, "sound="))
   return w
Example #2
0
def load_game_object(buf, o) :
   o.m.r.width = fp.read_named_float(buf, "width=")
   o.m.r.height = fp.read_named_float(buf, "height=")
   tex = Texture()
   il.load_image(fp.read_named_string(buf, "tex="), tex)
   o.set_texture(tex)
   sdanim = fp.read_named_string(buf, "dest_anim=") 
   sdsound = fp.read_named_string(buf, "dest_sound=")
   if len(sdanim) != 0 :
      o.dest_anim = AnimationLoader.load(sdanim)
   if len(sdsound) != 0 :
      o.dest_sound = sl.load(sdsound)