Construct a ThrowableBehavior
Optionaldamage?: numberHow much damage should this do? (default 1)
OptionaldisappearOnCollide?: booleanShould this disappear when it collides with another throwable? (default true)
Optionalreclaimer?: (actor: Actor) => voidCode to run when this is reclaimed due to a collision
Optionalteam?: numberThe team this actor belongs to (default 0)
Protected Optional_The actor associated with this Behavior
How much damage does this throwable do?
When throwables collide, and they are not sensors, one will disappear. We can keep both on screen by setting this false
ReadonlyrangeThis is the initial point from which the throwable was tossed
Optional ReadonlyreclaimerCode to run when this throwable is reclaimed due to a collision
Which "team" this Behavior belongs to. A team is just a number, and for
the most part it's only when user code consults teams that teams have
meaning. The only exception is that HazardBehavior uses team to prevent
team attack damage.
The actor associated with this Behavior
Attaching this behavior upgrades a non-dynamic body to dynamic, and
marks it as a "bullet" (Box2D's continuous collision detection) so a
fast-moving throwable can't tunnel through a thin wall between physics
steps. ProjectileMovement already does this too, but a throwable
shouldn't depend on also having a ProjectileMovement to get it.
Indicate that this Behavior should ignore collisions with some other property
ProtecteddisableTurn off physical collisions for actor. Used by Behaviors that are only
ever passed through, not physically collided with, like coins.
The actor being attached (may be undefined, if this Behavior is being detached)
ProtectedrequireIf actor's body isn't dynamic, warn and upgrade it to dynamic. Used
by every Behavior whose whole point requires a dynamic body (e.g.
setVelocity/forces actually doing something).
The actor being attached (may be undefined, if this Behavior is being detached)
The name to use in the warning message
Toss in the direction of a specified point.
The actor who is performing the toss
OptionalfixedVectorVelocity?: numberA fixed velocity, regardless of distance
The center of the actor doing the toss
Optionalmultiplier?: numberA multiplier on speed
The distance between the center of the throwable and the center of the actor tossing it
OptionalrotateVectorToss?: booleanShould this be rotated to face the direction it's tossed?
The point at which to toss
ThrowableBehavior is for actors that can be tossed from another actor's location, in order to damage hazards.