◇
component · drop-in viewer
Hero
One instance, on the scene's `MountHero`. Owns the figure, health and stamina, and the four attacks from `G.ATTACKS`.
by·posted 25d ago
What it does
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()— reachesMountHero, subscribes toPLAYER_HITandRESTART.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
CharacterControllerandLocomotion, 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
reachand inside the half-anglearcaround the facing, so a swing across the room does nothing. The eight attacks' numbers are inG.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.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.