class
#include <Jazz2/Actors/ActorBase.h>
ActorBase Base class of an object.
Derived classes
- class CollectibleBase
- Base class of a collectible object.
- class GemGiant
- class EnemyBase
- Base class of an enemy.
- class AirboardGenerator
- class AmbientBubbles
- class AmbientSound
- class Bird
- class Bomb
- class BonusWarp
- class Checkpoint
- class Copter
- class EndOfLevel
- class Eva
- class IceBlock
- class Moth
- class Spring
- class SteamNote
- class SwingingVine
- class Explosion
- Explosion effects.
- class FlickerLight
- class PulsatingRadialLight
- class StaticRadialLight
- class RemoteActor
- Remote object in online session.
- class Player
- Represents a controllable player.
- class PlayerCorpse
- Represents a dead coprse of a player.
- class Bridge
- class Pole
- class SolidObjectBase
- Base class of a (pushable) solid object.
- class ShotBase
- Base class of a shot from a player's weapon.
- class TNT
- class Jazz2::Scripting::ScriptActorWrapper
Constructors, destructors, conversion operators
- ActorBase()
- ~ActorBase() virtual
Public functions
- auto IsFacingLeft() -> bool
- Returns
true
if the object is currently facing left. - void SetParent(SceneNode* parent)
- auto OnActivated(const ActorActivationDetails& details) -> Task<bool>
- Called after the object is created.
-
auto OnHandleCollision(std::
shared_ptr<ActorBase> other) -> bool virtual - Called when the object collides with another object.
- auto IsInvulnerable() -> bool
- Returns
true
if the object is invulnerable. -
auto GetHealth() -> std::
int32_t - Returns current health.
-
void SetHealth(std::
int32_t value) - Sets current health.
-
auto GetMaxHealth() -> std::
int32_t - Returns maximum health.
-
void DecreaseHealth(std::
int32_t amount = 1, ActorBase* collider = nullptr) - Decreases health by specified amount.
-
auto MoveInstantly(Vector2f pos,
MoveType type,
Tiles::
TileCollisionParams& params) -> bool - Moves the object.
- auto MoveInstantly(Vector2f pos, MoveType type) -> bool
- void AddExternalForce(float x, float y)
- Adds external force.
- auto IsCollidingWith(ActorBase* other) -> bool
- Returns
true
if this object is colliding with a given object. - auto IsCollidingWith(const AABBf& aabb) -> bool
- Returns
true
if this object is colliding with a given AABB. - void UpdateAABB()
- Updates AABB for current position, rotation and animation frame.
- auto GetPos() -> Vector2f
- Returns current position.
- auto GetSpeed() -> Vector2f
- Returns current speed.
- auto GetState() const -> ActorState constexpr noexcept
- Returns actor state.
- auto GetState(ActorState flag) const -> bool constexpr noexcept
Public variables
Protected types
- class ActorRenderer
- Actor renderer.
Protected static functions
- static void PreloadMetadataAsync(StringView path)
- Preloads specified metadata and its linked assets to cache.
Protected functions
- void SetFacingLeft(bool value)
- Sets whether the object is facing left.
- auto OnActivatedAsync(const ActorActivationDetails& details) -> Task<bool> virtual
- Called when the object is created and activated.
- auto OnTileDeactivated() -> bool virtual
- Called when corresponding tile should be deactivated.
- void OnHealthChanged(ActorBase* collider) virtual
- Called when health of the object changed.
- auto OnPerish(ActorBase* collider) -> bool virtual
- Called when the object has no health left and should perish.
- void OnUpdate(float timeMult) virtual
- Called every frame to update the object state.
- void OnUpdateHitbox() virtual
- Called when the hitbox needs to be updated.
- auto OnDraw(RenderQueue& renderQueue) -> bool virtual
- Called when the object needs to be drawn.
- void OnEmitLights(SmallVectorImpl<LightEmitter>& lights) virtual
- Called when emitting lights.
- void OnHitFloor(float timeMult) virtual
- Called when the object hits a floor.
- void OnHitCeiling(float timeMult) virtual
- Called when the object hits a ceiling.
- void OnHitWall(float timeMult) virtual
- Called when the object hits a wall.
- void OnTriggeredEvent(EventType eventType, uint8_t* eventParams) virtual
- Called when an event is triggered.
-
void TryStandardMovement(float timeMult,
Tiles::
TileCollisionParams& params) - Performs standard movement behavior.
-
void UpdateHitbox(std::
int32_t w, std:: int32_t h) - Updates hitbox to a given size.
- void UpdateFrozenState(float timeMult)
- void HandleFrozenStateChange(ActorBase* shot)
- void CreateParticleDebris()
- Creates a particle debris from a sprite.
-
void CreateSpriteDebris(AnimState state,
std::
int32_t count) - Creates a sprite debris.
- auto GetIceShrapnelScale() const -> float virtual
- Returns scale of ice shrapnels.
-
auto PlaySfx(StringView identifier,
float gain = 1.0f,
float pitch = 1.0f) -> std::
shared_ptr<AudioBufferPlayer> - Plays a sound effect for the object.
- auto SetAnimation(AnimState state, bool skipAnimation = false) -> bool
- Sets an animation of the object.
- auto SetTransition(AnimState state, bool cancellable, Function<void()>&& callback = {}) -> bool
- Sets a transition animation of the object.
- void CancelTransition()
- Cancels a cancellable transition.
- void ForceCancelTransition()
- Cancels any transition.
- void OnAnimationStarted() virtual
- Called when an animation started.
- void OnAnimationFinished() virtual
- Called when an animation finished.
- void RequestMetadata(StringView path)
- Loads specified metadata and its linked assets.
- void RequestMetadataAsync(StringView path)
- Loads specified metadata and its linked assets asynchronously if supported.
- void SetState(ActorState flags) constexpr noexcept
- Sets actor state.
- void SetState(ActorState flag, bool value) constexpr noexcept
Protected static variables
-
static std::
uint8_t AlphaThreshold constexpr - static float CollisionCheckStep constexpr
-
static std::
int32_t PerPixelCollisionStep constexpr -
static std::
int32_t AnimationCandidatesCount constexpr
Function documentation
bool Jazz2:: Actors:: ActorBase:: MoveInstantly(Vector2f pos,
MoveType type)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Jazz2:: Actors:: ActorBase:: GetState(ActorState flag) const constexpr noexcept
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Jazz2:: Actors:: ActorBase:: SetState(ActorState flag,
bool value) protected constexpr noexcept
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.