Class for game objects.
This class is used for game objects, such as the player, enemies, bullets, and the HUD. Generally, each type of object has its own subclass of StellarClass.
One attribute which needs some explanation is active. This attribute indicates whether the object is active (True) or inactive (False). While the object is active, it will exhibit normal behavior; events will be executed normally as will any other automatic functionality, such as adding xvelocity and yvelocity to x and y. If active is False, automatic functionality and normal events will be disabled and events which have names starting with “event_inactive_” will be executed instead of the corresponding normal events.
It is important to recognize that making an object inactive is not like deactivating an instance in Game Maker. Unlike deactivated instances in Game Maker, inactive StellarClass objects are still visible by default and continue to be involved in collisions. In addition, collision events and destroy events still occur even if the object is inactive. If you wish for the object to not be visible, set visible to False. If you wish for the object to not be involved in collisions, set detects_collisions to False.
It is also important to note that making an object inactive will not likely have a significant effect on performance. For performance enhancement, it is far more effective to exclude objects from collision detection. Object deactivation is meant to be used to easily maintain control over objects that are currently being excluded from collision detection (e.g. to prevent a gravity effect that would otherwise occur, or to prevent the object from moving through walls).
Attributes:
Read-Only Attributes:
Create a new StellarClass object.
Arguments:
All other arugments set the respective initial attributes of the object. See the documentation for StellarClass for more information.
Return whether or not this object collides with another.
Arguments:
Set an alarm.
Arguments:
After this method is called, value will reduce by 1 each frame (adjusted for delta timing if it is enabled) until it reaches 0, at which point StellarClass.event_alarm will be executed with alarm_id.
Return the value of an alarm.
Arguments:
If the alarm has not been set, None will be returned.
Destroy the object.
Create an object of this class in the current room it.
args and kwargs are passed to cls.__init__ as arguments. Calling obj = cls.create(*args, **kwargs) is the same as::
obj = cls(*args, **kwargs)
sge.game.current_room.add(obj)
Create event.
Called when the object is created. It is always called after any room start events occurring at the same time.
Destroy event.
Step event.
See the documentation for sge.Game.event_step for more information.
Alarm event.
Called when the value of an alarm reaches 0.
Arguments:
Animation End event.
Called when an animation cycle ends.
Key press event.
See the documentation for sge.Game.event_key_press for more information.
Key release event.
See the documentation for sge.Game.event_key_release for more information.
Mouse move event.
See the documentation for sge.Game.event_mouse_move for more information.
Mouse button press event.
See the documentation for sge.Game.event_mouse_button_press for more information.
Mouse button release event.
See the documentation for sge.Game.event_mouse_button_release for more information.
Joystick axis move event.
See the documentation for sge.Game.event_joystick_axis_move for more information.
Joystick HAT move event.
See the documentation for sge.Game.event_joystick_hat_move for more information.
Joystick trackball move event.
See the documentation for sge.Game.event_joystick_trackball_move for more information.
Joystick button press event.
See the documentation for sge.Game.event_joystick_button_press for more information.
Joystick button release event.
See the documentation for sge.Game.event_joystick_button_release for more information.
Default collision event.
Called when another object collides with this object and none of the directional collision events are appropriate. In particular, this is called if the collision was already happening in the previous frame. This is also the event method called by the directional collision event methods by default.
Arguments:
Left collision event.
Called when another object collides with this object’s left side.
Arguments:
By default, this method simply calls StellarClass.event_collision.
Right collision event.
Called when another object collides with this object’s right side.
Arguments:
By default, this method simply calls StellarClass.event_collision.
Top collision event.
Called when another object collides with this object’s top side.
Arguments:
By default, this method simply calls StellarClass.event_collision.
Bottom collision event.
Called when another object collides with this object’s bottom side.
Arguments:
By default, this method simply calls StellarClass.event_collision.
Step event when this object is inactive.
See the documentation for sge.Game.event_step for more information. The object is considered to be inactive when its active attribute is False.
Key press event when this object is inactive.
See the documentation for sge.Game.event_key_press for more information. The object is considered to be inactive when its active attribute is False.
Key release event when this object is inactive.
See the documentation for sge.Game.event_key_release for more information. The object is considered to be inactive when its active attribute is False.
Mouse move event when this object is inactive.
See the documentation for sge.Game.event_mouse_move for more information. The object is considered to be inactive when its active attribute is False.
Mouse button press event when this object is inactive.
See the documentation for sge.Game.event_mouse_button_press for more information. The object is considered to be inactive when its active attribute is False.
Mouse button release event when this object is inactive.
See the documentation for sge.Game.event_mouse_button_release for more information. The object is considered to be inactive when its active attribute is False.
Joystick axis move event when this object is inactive.
See the documentation for sge.Game.event_joystick_axis_move for more information. The object is considered to be inactive when its active attribute is False.
Joystick HAT move event when this object is inactive.
See the documentation for sge.Game.event_joystick_hat_move for more information. The object is considered to be inactive when its active attribute is False.
Joystick trackball move event when this object is inactive.
See the documentation for sge.Game.event_joystick_trackball_move for more information. The object is considered to be inactive when its active attribute is False.
Joystick button press event when this object is inactive.
See the documentation for sge.Game.event_joystick_button_press for more information. The object is considered to be inactive when its active attribute is False.
Joystick button release event when this object is inactive.
See the documentation for sge.Game.event_joystick_button_release for more information. The object is considered to be inactive when its active attribute is False.
Key press event when paused.
See the documentation for sge.Game.event_key_press for more information.
Key release event when paused.
See the documentation for sge.Game.event_key_release for more information.
Mouse move event when paused.
See the documentation for sge.Game.event_mouse_move for more information.
Mouse button press event when paused.
See the documentation for sge.Game.event_mouse_button_press for more information.
Mouse button release event when paused.
See the documentation for sge.Game.event_mouse_button_release for more information.
Joystick axis move event when paused.
See the documentation for sge.Game.event_joystick_axis_move for more information.
Joystick HAT move event when paused.
See the documentation for sge.Game.event_joystick_hat_move for more information.
Joystick trackball move event when paused.
See the documentation for sge.Game.event_joystick_trackball_move for more information.
Joystick button press event when paused.
See the documentation for sge.Game.event_joystick_button_press for more information.
Joystick button release event when paused.
See the documentation for sge.Game.event_joystick_button_release for more information.