Log inGet started
Package

PlayerBody.component

Newest version

README.md

PlayerBody

The player in Spooky Spook Spook. It sits on PlayerSetups/SkullPlayer/body, which is a dynamic sphere with r = 0.35. On the live clone it sets R.state.playerEntity.

  • Input: game.player.skull inputMap gives move, jump, attack and cast. Each control is bound for keyboard/mouse, gamepad and touch. They are read only while R.state.phase == "fight".
  • Movement: a lone skull rolls, and its visual rotates with the distance travelled. Legs make it walk upright faster, with stepping legs and a jump. Speed comes from R.computeStats.
  • Attacks: there are five kinds: headbutt (no arms), swing (arms), bite (each extra skull), tailsweep (tails) and bolt (magic bones, with nearestEnemy aim assist). Each one calls R.call("hitEnemies", center, radius, damage, knockback, kind) and emits playerAttack.
  • Visual: game.player.skeleton rebuilds the procedural skeleton on buildChanged/waveStarted, using branching sockets per R.BONE_KINDS. Meshes come from game.player.bonemesh: runtime meshes shaped by each bone's seed, length and weight.
  • First person: the eye height follows the build (standHeight), written to the first_person offsetY. A view model with bony arms, a femur club and a glowing magic bone is parented to the camera rig. The body's own skull and arms sit on render layer sspSelf, and the camera excludes that layer.
  • Providers: buildSkeletonVisual(parentId, build) -> rootId builds the model standing on the parent origin, with glowing open sockets. buildBoneVisual(parentId, bone) -> rootId builds one bone centred on the parent, outlined in its rarity colour.
  • Telemetry fields: lastAttack, lastHits, totalHits, eyeHeight.