Skip to content

BumpAttack

A roguelike’s attack, with no code: its GridMovement stepping into something with Health on its Layers hurts it by Damage instead of bumping, with a lunge toward it and back over a step’s time. Holding the way keeps hitting. On a player it attacks the monsters it walks into; on a monster with a GridChase whose Stop Distance is 0, it attacks the player it walks into.

Taking turns, each hit uses an action, as a step does. A Health with an Invincible Time ignores hits while it lasts: 0 lets each step’s hit land. In a network game the host does the damage.

Requires: GridMovement

Works with: GridChase (with Stop Distance 0, a monster that hits what it chases)

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • damage: a number = 1. Hit points each hit takes away. (Field: a number.)
  • damageRoll: text = null. Dice rolled for each hit’s damage in place of Damage, e.g. “1d8+2”; empty hits for Damage every time. Table Values sets it from a dice column given for Damage. (Dice: how many, “d”, their sides, then anything added or taken away, e.g. “2d6+3”, “d20”, “1d8+1d6-1” or a plain number; empty for none. The Inspector builds them and shows the lowest, highest and average roll.) (Field: its own editor: Dice.)
  • layers: text = “Enemy”. The collision layers it hurts, e.g. “Enemy” (or “Player” for a monster). Empty hurts anything with health. (Names collision layers: their names, separated by commas.) (Field: a name.)
  • sound: text = null. A sound played with each hit, e.g. “Sounds/hit.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • effect: text = null. A prefab spawned on what it hits, e.g. “Sparkle”: a burst of particles, a damage number. (Names a prefab.) (Field: a name.)
  • hitStop: a number = 0. Freezes the game for this many seconds when a hit lands, so it hits hard. 0 for none. (Field: a number.)

Scripts use it as BumpAttack: its methods, events and values that aren’t saved with the scene.