xSGE Path

xSGE is a collection of higher-level extensions for the SGE which enhance the core functionality in an implementation-independent way. Like the SGE itself, they are distribted under the terms of the GNU Lesser General Public License.

This extension provides paths for the SGE. Paths are used to make objects move in a certain way.

xsge_path Classes


class xsge_path.Path(x, y, points=(), z=0, visible=False, tangible=False, **kwargs)

Class for paths: objects which define movement patterns for other objects. Paths are defined as a series of points for an object to follow.

This class is derived from sge.dsp.Object and inherits all of that class's attributes and methods.


event_step() is used to implement path-following behavior. Keep this in mind if you derive a class from this one.


A list of the points that make up the path relative to the position of the path in the room, excluding the first point. Each point should be a tuple in the form (x, y), where x is the horizontal location and y is the vertical location. The first point is always (0, 0), which is why it is not included in this list.

xsge_path.Path Methods

Path.__init__(x, y, points=(), z=0, visible=False, tangible=False, **kwargs)

Arguments set the respective initial attributes of the object. See the documentation for Path for more information.

x, y, z, visible, tangible, and all arguments passed to kwargs are passed as the corresponding arguments to the constructor method of the parent class.

Path.follow_start(obj, speed, accel=None, decel=None, loop=0)

Cause obj to start following this path at the speed indicated by speed.

While path objects have a location within the room, this location has no bearing on how objects following the path move. Movement is determined relative to the location of the object following the path when it started, not the location of the path.

By default, the object follows the path at a constant speed. If accel or decel is set to a value other than None, the object will instead accelerate or decelerate, respectively, by that amount each frame on each segment of the path.

loop indicates the number of times the object should follow the path after it does so the first time. For example, if set to 2, the object will follow the path a total of 3 times. Set to None to loop indefinitely.


Cause obj to stop following this path.

xsge_path.Path Event Methods


Called when an object, indicated by obj, finishes following the path.