Base TetraScript Object
Description
All TetraScript objects inherit from this class. Includes all common properties, actions, and triggers.
Properties
- SpriteSheet path, hframes, vframes
- Sets the sprite sheet to the png file found at ‘path’. Splits frames by ‘hframes’ and ‘vframes’.
- ‘path’ – an image at “res://game/objects/stalfaux.png” would be typed in as “objects/stalfaux”. Omit the path before the world root and the file extension. Only png files are accepted.
- ‘hframes’ – amount of horizontal frames in the sprite sheet. Must be evenly spaced.
- ‘vframes’ – amount of vertical frames in the sprite sheet. Must be evenly spaced.
- Size width, height
- Creates capsule collision with ‘width’ and ‘height’.
Actions
- anim_play(animation)
- Plays ‘animation’ defined in Animations. anim_play(“throw”) will play an animation called “throw”
- anim_dir_play(animation)
- Plays one of three animations based on object’s direction. Animations must be named “animUp”, “animDown”, and “animSide”. For example, anim_dir_play(“idle”) will play “idleUp”, “idleDown”, or “idleSide” depending on the object’s direction.
- change_state(state)
- Changes state. Use at the end of a state without triggers to run every action before it once and immediately go to another state.
Triggers
- anim_finished()
- Triggers whenever the current animation is finished playing. Combine with anim_play(animation) to create animated state transitions.
- object_entered(radius, group)
- Triggers if an object in group is within ‘radius’. ‘group’ can be any object type, including enemy, player, etc. ‘radius’ is measured in pixels.
- object_exited(radius, group)
- Triggers if an object in group is outside of ‘radius’. ‘group’ can be any object type, including enemy, player, etc. ‘radius’ is measured in pixels.
- timer(length)
- Triggers after inputted ‘length’ have passed.