rex_light
Introduction
Adjust instance width until overlap obstacle.
Adjust instance width until overlap obstacle.
Usage
Concept
This behavior will adjust instance width until overlap (hit) obstacle, or set to the maximum width if no obstacle hit.
The maximum width could be set in "Max width" in properties table, or set by "Action:Set maximum width".
This behavior will adjust instance width until overlap (hit) obstacle, or set to the maximum width if no obstacle hit.
The maximum width could be set in "Max width" in properties table, or set by "Action:Set maximum width".
Prepare
The origin point of this sprite must be set to the left most side, and the shape of this sprite is a bar.
The origin point of this sprite must be set to the left most side, and the shape of this sprite is a bar.
Tick
Sample capx
This behavior could adjust instance width every tick by set "Initial state" to "Enabled" in properties table, or set by "Action:Set enabled".
There are 2 kinds of obstacles, selected by "Obstacles" in properties table,
Sample capx
This behavior could adjust instance width every tick by set "Initial state" to "Enabled" in properties table, or set by "Action:Set enabled".
There are 2 kinds of obstacles, selected by "Obstacles" in properties table,
- Solids: objects with solid enable
- Custom: objects assigned in event sheet by "Action:Add obstacle", "Action:Clear obstacles"
Manually
Sample capx
Call "Action:Point to solids" or "Action:Point to object" to adjust instance width manually.
The "Condition:Hit" will return true if this instance overlaps (hit) obstacle after these actions.Get the hit position by ("Expression:HitX", "Expression:HitY"), the UID of overlapped object by "Expression:HitUID". The hit position is at the right most side of this instance.
"Expression:ReflectionAngle" could be used to get angle of reflection, the parameter is angle of normal vector.
Sample capx
Call "Action:Point to solids" or "Action:Point to object" to adjust instance width manually.
The "Condition:Hit" will return true if this instance overlaps (hit) obstacle after these actions.Get the hit position by ("Expression:HitX", "Expression:HitY"), the UID of overlapped object by "Expression:HitUID". The hit position is at the right most side of this instance.
"Expression:ReflectionAngle" could be used to get angle of reflection, the parameter is angle of normal vector.
Reflection angle
"Expression:ReflectionAngle" could be used to get reflection angle by a normal angle. This input parameter could be ignored if the hit obstacles -
"Expression:ReflectionAngle" could be used to get reflection angle by a normal angle. This input parameter could be ignored if the hit obstacles -
- the hotspot is in center
- the collision polygon is a rectangle
More examples
Laser bounces at 4 sides (@mattb) (reference)
Laser bounces at 4 sides (@mattb) (reference)