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.
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.Objectand 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.
__init__(x, y, points=(), z=0, visible=False, tangible=False, **kwargs)¶
Arguments set the respective initial attributes of the object. See the documentation for
Pathfor more information.
tangible, and all arguments passed to
kwargsare passed as the corresponding arguments to the constructor method of the parent class.
follow_start(obj, speed, accel=None, decel=None, loop=0)¶
objto start following this path at the speed indicated by
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
decelis 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.
loopindicates 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
Noneto loop indefinitely.
objto stop following this path.