GameMaker Touhou Engine   Home   Downloads   Documentation

_CURVY_LASER_HEAD_PARENT


The parent object that represents the front of a given curvy laser.


Parent: _BOMB_IMMUNE_ENEMY_BULLET_PARENT


Locals:


Name Type Significance
_LOOKAHEAD_RADIUS Integer The distance from the head to the first control point (see illustration).
_TAIL Reference to Object The reference to the instance of _CURVY_LASER_TAIL_PARENT tied to this object.
_LENGTH Non-negative Integer Not an actual measure of distance, rather the time it takes between individual movements of the head and tail.
_SURFACE Surface The surface which the individual pieces of the laser are drawn onto, used to construct the laser's sprite.
_SPRITE_BACK* Reference to Sprite The background sprite of each individual segment of the laser.
_SPRITE_FRONT* Reference to Sprite The foreground sprite of each individual segment of the laser.
_TOTAL_SEGMENT_COUNT Positive Integer The amount of points that the bezier curve representing the laser is made of. Defaults to 64.
_JOINT_SEGMENT_COUNT Positive Integer The amount of times the given sprites should be drawn between each point. Defaults to 16.

*Due to how blend modes interact with surfaces in GMS, these sprites have to have pre-multiplied alpha values. In some later versions, this can be done from the sprite editor in the program itself, but for earlier versions, this has to be done in an external image editor.


Events:


Trigger # Actions
Create 1 Declare local variables. Bind self with own tail.
Destroy 1 Destroy the tail and free allocated dynamic resources.
Alarm 11 1 Perform the next indicated behavior or repeat the last one if needed. Note that curvy lasers can only perform the following behaviors: _CURVE, _SET_SPEED, _SET_ACCEL, _ADD_BEHAVIORS, _CHANGE_SPRITE and _CLEAR_BEHAVIOR.
End Step 1 If own self and the tail are outside bounds, destroy self.
Draw 1 Calculate all of the points on the bezier curve representing the laser. Resize the surface and draw the individual segments onto it, then set own sprite according to the surface with a precise collision mask. Draw self.


Below is an illustration provided for clarity as to the geometry behind curvy lasers.


curvy laser demonstration