Beispiel #1
0
    def __init__(self, identifier, name, scene, batch=None, attrs=None):
        super(Actor, self).__init__()
        attrs = attrs or {}
        self.name = name
        self.scene = scene
        self.use_mask_to_detect_clicks = True

        self.identifier = identifier
        self.walkpath_point = None
        self.resource_path = util.respath_func_with_base_path(
            'actors', self.name)

        self.update_static_info()
        self.current_state = Actor.info[self.name]['start_state']

        self.walk_speed = Actor.info[self.name].get('walk_speed', 400.0)
        self.anchor_x = Actor.info[self.name]['anchor_x']
        self.anchor_y = Actor.info[self.name]['anchor_y']
        self.current_state = attrs.get('start_state',
                                       Actor.info[self.name]['start_state'])
        self.casts_shadow = Actor.info[self.name].get('casts_shadow', False)

        if self.scene and batch is None:
            batch = self.scene.batch

        self.sprite = pyglet.sprite.Sprite(
            Actor.images[self.name][self.current_state], batch=batch)

        self.make_icon()

        # Update attributes
        for attr in ['x', 'y', 'scale', 'rotation', 'opacity']:
            if attrs.has_key(attr):
                setattr(self.sprite, attr, attrs[attr])
Beispiel #2
0
 def __init__(self, identifier, name, scene, batch=None, attrs=None):
     super(Actor, self).__init__()
     attrs = attrs or {}
     self.name = name
     self.scene = scene
     
     self.identifier = identifier
     self.walkpath_point = None
     self.resource_path = util.respath_func_with_base_path('actors', self.name)
     
     self.update_static_info()
     self.current_state = Actor.info[self.name]['start_state']
     
     self.walk_speed = Actor.info[self.name].get('walk_speed', 400.0)
     self.anchor_x = Actor.info[self.name]['anchor_x']
     self.anchor_y = Actor.info[self.name]['anchor_y']
     self.current_state = attrs.get('start_state', Actor.info[self.name]['start_state'])
     self.casts_shadow = Actor.info[self.name].get('casts_shadow', False)
     
     if self.scene and batch is None:
         batch = self.scene.batch
     
     self.sprite = pyglet.sprite.Sprite(Actor.images[self.name][self.current_state], batch=batch)
     
     self.make_icon()
     
     # Update attributes
     for attr in ['x', 'y', 'scale', 'rotation', 'opacity']:
         if attrs.has_key(attr):
             setattr(self.sprite, attr, attrs[attr])
Beispiel #3
0
    def __init__(self, identifier, name, scene, batch=None, attrs=None):
        super(Actor, self).__init__()
        attrs = attrs or {}
        self.name = name
        self.scene = scene
        self.use_mask_to_detect_clicks = True

        self.identifier = identifier
        self.walkpath_point = None
        self.resource_path = util.respath_func_with_base_path("actors", self.name)

        self.update_static_info()
        self.current_state = Actor.info[self.name]["start_state"]

        self.walk_speed = Actor.info[self.name].get("walk_speed", 400.0)
        self.anchor_x = Actor.info[self.name]["anchor_x"]
        self.anchor_y = Actor.info[self.name]["anchor_y"]
        self.current_state = attrs.get("start_state", Actor.info[self.name]["start_state"])
        self.casts_shadow = Actor.info[self.name].get("casts_shadow", False)

        if self.scene and batch is None:
            batch = self.scene.batch

        self.sprite = pyglet.sprite.Sprite(Actor.images[self.name][self.current_state], batch=batch)

        self.make_icon()

        # Update attributes
        for attr in ["x", "y", "scale", "rotation", "opacity"]:
            if attrs.has_key(attr):
                setattr(self.sprite, attr, attrs[attr])
Beispiel #4
0
    def __init__(self,
                 name,
                 scene_handler=None,
                 ui=None,
                 load_path=None,
                 clip=True):
        super(Scene, self).__init__()
        self.name = name
        self.handler = scene_handler
        self.batch = pyglet.graphics.Batch()
        self.fresh = (load_path is None)
        if clip:
            self.main_group = ClipGroup(w=gamestate.main_window.width,
                                        h=gamestate.main_window.height)
        else:
            self.main_group = None
        self.ui = ui
        self.actors = {}
        self.camera_points = {}
        self.interaction_enabled = True
        self.blackout = False

        self.game_time = 0.0
        self.accum_time = 0.0
        self.clock = pyglet.clock.Clock(time_function=lambda: self.game_time)
        self.paused = False
        self.x_offset = 0.0
        self.y_offset = 0.0

        self.sound_player = sound.Sound()
        self.shadow = shadow.ShadowManager()

        self.moving_camera = False

        self.resource_path = util.respath_func_with_base_path(
            'game', self.name)

        self.init_clock()
        self.init_zenforcer()
        self.interp = interpolator.InterpolatorController()
        self.convo = convo.Conversation(self)
        self.background_convos = set()
        self.init_convenience_bindings()

        self.load_info(load_path)
        self.initialize_from_info()
        self.load_actors()
        self.zenforcer.init_groups()

        if gamestate.scripts_enabled:
            self.load_script()

        for i in xrange(10):
            self.zenforcer.update()

        self.update(0)
Beispiel #5
0
    def __init__ (self, volume = 1.0):
        self.volume = volume

        self.player = pyglet.media.Player()
        self.player.volume = self.volume
        self.player.eos_action = 'stop'

        self.path = util.respath_func_with_base_path("sound")

        self.sound_cache = {}
Beispiel #6
0
    def __init__(self, volume=1.0):
        self.volume = volume

        self.player = pyglet.media.Player()
        self.player.volume = self.volume
        self.player.eos_action = 'stop'

        self.path = util.respath_func_with_base_path("sound")

        self.sound_cache = {}
Beispiel #7
0
 def __init__(self, name, scene_handler=None, ui=None, load_path=None, clip=True):
     super(Scene, self).__init__()
     self.name = name
     self.handler = scene_handler
     self.batch = pyglet.graphics.Batch()
     self.fresh = (load_path is None)
     if clip:
         self.main_group = ClipGroup(w=gamestate.main_window.width, 
                                     h=gamestate.main_window.height)
     else:
         self.main_group = None
     self.ui = ui
     self.actors = {}
     self.camera_points = {}
     self.interaction_enabled = True
     self.blackout = False
     
     self.game_time = 0.0
     self.accum_time = 0.0
     self.clock = pyglet.clock.Clock(time_function=lambda: self.game_time)
     self.paused = False
     self.x_offset = 0.0
     self.y_offset = 0.0
     
     self.sound_player = sound.Sound()
     self.shadow = shadow.ShadowManager()
     
     self.moving_camera = False
     
     self.resource_path = util.respath_func_with_base_path('game', self.name)
     
     self.init_clock()
     self.init_zenforcer()
     self.interp = interpolator.InterpolatorController()
     self.convo = convo.Conversation(self)
     self.background_convos = set()
     self.init_convenience_bindings()
     
     self.load_info(load_path)
     self.initialize_from_info()
     self.load_actors()
     self.zenforcer.init_groups()
     
     if gamestate.scripts_enabled:
         self.load_script()
     
     for i in xrange(10):
         self.zenforcer.update()
     
     self.update(0)
Beispiel #8
0
    def __init__(self, handler, volume=1.0):
        super(DJ, self).__init__()
        self.handler = handler
        self.volume = volume
        
        self.player = pyglet.media.Player()
        self.player.eos_action = 'loop'
        self.player.volume = self.volume
        
        self.current_sound_name = ''
        self.next_sound_name = ''

        self.res = util.respath_func_with_base_path('music')
        
        self.sound_cache = {}

        self.seq = actionsequencer.ActionSequencer()
        self.interp = interpolator.InterpolatorController()
        
        self.update = self.interp.update_interpolators