Log inGet started
World

Ganesha: Guardian of the Portal

Branchmain
Branchesmain
Commit1ae1a54e78

README.md

Hero — the guardian the player is

One instance, on the scene's MountHero. Owns the figure, health and stamina, and the four attacks from G.ATTACKS.

Public fields

None. The guardian's state lives in game.Game.state.

Methods

  • :attack(id) — begin one of "light", "heavy", "divine", "ultimate".
  • :facing() — the guardian's current facing, in radians.

Lifecycle

  • start() — reaches MountHero, subscribes to PLAYER_HIT and RESTART.
  • update(dt) — finds the local player's avatar, dresses it the first time it is seen, ticks cooldowns and stamina, reads the controls, swings the trishul, and resolves the attack that is in its active window.
  • onDestroy() — unsubscribes and despawns the figure.

Notes

  • It does not move the body. The scene's avatar already carries the engine's own CharacterController and Locomotion, which answer WASD, SHIFT and SPACE with no code here. This dresses that body and reads the same frame's input for the weapon.
  • Damage is decided here, not by the foe. An attack may only touch a foe inside its reach and inside the half-angle arc around the facing, so a swing across the room does nothing. The eight attacks' numbers are in G.ATTACKS.
  • The stock humanoid mesh is hidden once per body, so the guardian's own faceted figure is what the camera sees while the engine still animates the skeleton underneath it.
  • Stamina is the sprint's and the abilities'. Sprinting drains it, standing still refills it, and an attack that costs more than half the bar is refused.