Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/SMGCommunity/Petari/llms.txt

Use this file to discover all available pages before exploring further.

Super Mario Galaxy 1 ships with over 90 unique enemy types. All enemies inherit LiveActor and follow the same lifecycle: init, control, attackSensor, receiveMsgPlayerAttack, and receiveOtherMsg. Ground-crawling enemies additionally share a set of reusable AI state classes prefixed WalkerState, which handle wandering, chasing, finding the player, stagger reactions, and star-pointer binding.
The Enemy.hpp aggregate header includes the most commonly used enemy headers. Additional enemies — such as Balloonfish, Jellyfish, NokonokoLand, and Teresa — live in include/Game/Enemy/ but are not re-exported by the aggregate.

WalkerState pattern

Most ground enemies compose their AI from four or five WalkerState* objects rather than implementing state logic directly in the actor. Each state subclasses ActorStateBase<LiveActor> and holds a reference to the host actor and shared WalkerStateParam constants.
The enemy walks to a random nearby point, waits, then picks a new destination. Controlled by speed, walk time, wait time, and a territorial radius.
class WalkerStateWanderParam {
public:
    /* 0x00 */ s32 mWaitTime;
    /* 0x04 */ s32 mWalkTime;
    /* 0x08 */ f32 mSpeed;
    /* 0x0C */ f32 mTurnMaxRateDegree;
    /* 0x10 */ f32 mTargetDistance;
};

class WalkerStateWander : public ActorStateBase<LiveActor> {
public:
    WalkerStateWander(LiveActor* pHost, TVec3f* pDirection,
                      WalkerStateParam* pStateParam,
                      WalkerStateWanderParam* pWanderParam);

    virtual void appear();

    void setWanderCenter(const TVec3f& rCenter);
    void exeWait();
    void exeWalk();

    /* 0x10 */ TVec3f* mDirection;
    /* 0x14 */ TerritoryMover* mTerritoryMover;
    /* 0x18 */ WalkerStateParam* mStateParam;
    /* 0x1C */ WalkerStateWanderParam* mWanderParam;
};
Triggers when the enemy first senses the player. Optionally plays a jump-start animation to signal awareness before transitioning to chase.
class WalkerStateFindPlayerParam {
public:
    /* 0x0 */ u32 mJumpStartStep;
    /* 0x4 */ f32 mJumpVelocity;
    /* 0x8 */ f32 mTurnMaxRateDegree;
};

class WalkerStateFindPlayer : public ActorStateBase<LiveActor> {
public:
    WalkerStateFindPlayer(LiveActor* pHost, TVec3f* pPosition,
                          WalkerStateParam* pStateParam,
                          WalkerStateFindPlayerParam* pFindPlayerParam);

    virtual void appear();

    void exeFind();
    void exeFindJumpStart();
    void exeFindJump();
    void exeFindJumpEnd();
    bool isInSightPlayer() const;
    bool isFindJumpBegin() const;
    bool isLandStart() const;

    /* 0x10 */ TVec3f* mDirection;
    /* 0x14 */ WalkerStateParam* mStateParam;
    /* 0x18 */ WalkerStateFindPlayerParam* mFindPlayerParam;
};
Steers the enemy toward Mario at mChaseSpeed for up to mChaseTime frames, then enters a wait period before transitioning back to wander.
class WalkerStateChaseParam {
public:
    /* 0x00 */ f32 mChaseSpeed;
    /* 0x04 */ s32 mChaseTime;
    /* 0x08 */ s32 mForceChaseEndTime;
    /* 0x0C */ f32 mTurnMaxRateDegree;
    /* 0x10 */ s32 mChaseEndWaitTime;
};

class WalkerStateChase : public ActorStateBase<LiveActor> {
public:
    WalkerStateChase(LiveActor* pHost, TVec3f* pDirection,
                     WalkerStateParam* pStateParam,
                     WalkerStateChaseParam* pChaseParam);

    virtual void appear();

    void exeStart();
    void exeEnd();
    bool isRunning() const;

    /* 0x10 */ WalkerStateParam* mStateParam;
    /* 0x14 */ WalkerStateChaseParam* mChaseParam;
    /* 0x18 */ TVec3f* mDirection;
};
These three states handle reactive behaviors. WalkerStateStagger plays a stagger animation when the enemy is spin-attacked but not killed. WalkerStateBlowDamage handles being launched by an explosion. WalkerStateBindStarPointer freezes the enemy while a star pointer is locked on.All three follow the same ActorStateBase<LiveActor> pattern and are created alongside the AI states during initState().

Kuribo (Goomba) — canonical WalkerState user

Kuribo is the simplest enemy that uses the full WalkerState composition pattern and serves as the reference implementation.
class Kuribo : public LiveActor {
public:
    Kuribo(const char*);

    virtual void init(const JMapInfoIter&);
    virtual void control();
    virtual void attackSensor(HitSensor*, HitSensor*);
    virtual bool receiveMsgPlayerAttack(u32, HitSensor*, HitSensor*);

    bool requestDead();
    bool requestFlatDown(HitSensor*, HitSensor*);
    bool requestHipDropDown(HitSensor*, HitSensor*);
    bool requestStagger(HitSensor*, HitSensor*);
    bool requestBlowDown(HitSensor*, HitSensor*);

    void exeWander();
    void exeFindPlayer();
    void exeChase();
    void exeStagger();
    void exeBlow();
    void exeBlowDown();
    void exeFlatDown();
    void exePressDown();
    void exeHipDropDown();
    void exeBindStarPointer();

    AnimScaleController* mScaleController;         // 0x8C
    ItemGenerator* mItemGenerator;                 // 0x90
    WalkerStateWander* mStateWander;               // 0x94
    WalkerStateFindPlayer* mStateFindPlayer;       // 0x98
    WalkerStateBindStarPointer* mBindStarPointer;  // 0x9C
    WalkerStateStagger* mStateStagger;             // 0xA0
    WalkerStateChase* mStateChase;                 // 0xA4
};

Enemy categories

Ground enemies that use the WalkerState pattern.
ClassCommon nameNotes
KuriboGoombaReference WalkerState user
KuriboChiefGoomba captainSpawns mini Goombas
KuriboMiniMini GoombaSummoned by KuriboChief
NokonokoLandKoopa TroopaShell kick mechanic
KaronDry BonesReassembles after stomp
BegomanBase / BegomanSpike / BegomanSpringTopman variantsSpin-attack sensitive
JumpSpiderSpider enemyJumps toward player
StinkBugBaseStinkbugGas cloud attack
MetboMecha-bugPatrol on rails
DossunThwompSmashes downward
JirairaBob-omb ground enemyProximity fuse
KaninaCrab enemySideways walker
Airborne enemies that move off the ground surface.
ClassCommon nameNotes
BombBirdBomb birdDrops BombBirdBomb projectiles
BalloonfishPuffer fish (air)Inflates on approach
BasaBasaBat enemySwoops at player
KoopaJrShipKoopa Jr. airshipMoving platform / enemy ship
TakoboOctopus bombFloats and launches
BombTeresaBomb BooPursues Mario with bomb
PoihanaSwoopin StuGlides along path
Enemies that live in or around water volumes.
ClassCommon nameNotes
JellyfishJellyfishElectric body hazard
JellyfishElectricElectric jellyfishVariant with full electric aura
PukupukuCheep CheepSwimming fish projectile
GessoBlooperInk-squirting squid
TeresaWaterWater BooAquatic ghost
WaterBazooka / WaterBazookaCapsuleWater launcherFixed turret + capsule projectile
Self-propelled hazards launched from other actors or fixed generators.
ClassCommon nameNotes
HomingKillerBullet Bill / TorpedoThree types: HomingKiller, Torpedo, MagnumKiller
HomingKillerLauncherBill blasterSpawns HomingKiller instances
FireBallFireballProjectile from fire Koopa or Mario
FireBubbleFirebar bubbleComponent of FireBar
ElectricPressureBulletElectric bulletFired by electric press enemies
CocoNutBallCoconut projectileThrown by coconut trees
KameckFireBallKameck fireballHoming magic from Kameck
Stationary enemies that fire energy beams or rings.
ClassCommon nameNotes
BallBeamerBall beamerFires energy balls on timer
EyeBeamerEye beamerScans and fires when player enters line of sight
RingBeamerRing beamerEmits RingBeam ring projectiles
SearchBeamerSearch beamerRotating spotlight beam
JumpBeamerJump beamerBeamer that also leaps
Enemies that do not fit neatly into the above categories.
ClassCommon nameNotes
TeresaBooTurns away when looked at
KameckKameck / MagikoopaCasts spells; used in boss arenas
KameckTurtleMagikoopa turtle mountCarrier for Kameck
PackunPetitPiranha PlantSnaps at nearby player
HammerHeadPackunHammer-head Piranha PlantCharges horizontally
SnakeheadSnakeheadChain of body segments
UnizoUrchinSlow roller, spike hazard
Mogu / MogucchiMonty Mole variantsPop up from ground
IceMerameraKingIce Lava KingTransforms between fire and ice
HanachanCaterpillarSegments that detach on hit
OtaRockRock throwerHurls boulders
KarikariPiranha pestBites and holds on

HomingKiller — projectile with Type enum

HomingKiller demonstrates how a single class covers multiple enemy subtypes via an in-class Type enum.
class HomingKiller : public LiveActor {
public:
    enum Type { Type_HomingKiller = 0, Type_Torpedo = 1, Type_MagnumKiller = 2 };

    virtual void init(const JMapInfoIter&);
    virtual void control();
    virtual void attackSensor(HitSensor* pSender, HitSensor* pReceiver);
    virtual bool receiveMsgPlayerAttack(u32, HitSensor*, HitSensor*);

    void appear(const TVec3f&, const TVec3f&);
    bool processChase();
    bool tryToExplosion(HitSensor*, HitSensor*);
    void sendMsgExplosionToNearActor();

    void exeAppear();
    void exeMoveStart();
    void exeMove();
    void exeChaseStart();
    void exeChase();
    void exeFreeze();
    void exeBreak();

    inline f32 getScale() {
        return mType == Type_MagnumKiller ? 4.0f : 1.0f;
    }

    /* 0x8C */ Type mType;
    /* 0x90 */ f32 mChaseStartDist;
    /* 0x94 */ f32 mChaseEndDist;
    /* 0x98 */ f32 mChaseRotateSpeed;
    /* 0xA0 */ TVec3f mFront;
    /* 0x15D */ bool mIsLinearShot;      // ignore gravity, disable chase
    /* 0x15E */ bool mUseFullSightAngle; // ignore gravity, full sight angle
};

BombBird — flying enemy with owned sub-actors

class BombBird : public LiveActor {
public:
    virtual void init(const JMapInfoIter&);
    virtual void control();
    virtual void attackSensor(HitSensor*, HitSensor*);
    virtual bool receiveMsgPlayerAttack(u32, HitSensor*, HitSensor*);

    void exeFlyOnRail();
    void exeFlyWithAttack();
    void exeBlow();
    void exeSwoonStart();
    void exeSwoon();
    void exeSwoonEnd();

    MR::FixedArray<BombBirdBomb*, 4> mBombs;       // 0x8C
    SpinHitController* mSpinHitController;          // 0xB0
    AnimScaleController* mScaleController;          // 0xB4
    WalkerStateBindStarPointer* mStarPointer;       // 0xB8
};
The AnimScaleController (declared in Enemy/AnimScaleController.hpp) is reused across many enemies to shrink the actor when it is squashed by a stomp. The SpinHitController (in Enemy/SpinHitController.hpp) centralizes spin-attack response logic.

Build docs developers (and LLMs) love