Skip to content

BumpAttack

namespace Griff.Scenes;
public sealed class BumpAttack : Component

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.

This is a component: its saved properties are on its component page.

public float Damage { get; set; }

Hit points each hit takes away.

public string? DamageRoll { get; set; }

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.

public string? Effect { get; set; }

A prefab spawned on what it hits, e.g. “Sparkle”: a burst of particles, a damage number.

public float HitStop { get; set; }

Freezes the game for this many seconds when a hit lands, so it hits hard. 0 for none.

public string? Layers { get; set; }

The collision layers it hurts, e.g. “Enemy” (or “Player” for a monster). Empty hurts anything with health.

public string? Sound { get; set; }

A sound played with each hit, e.g. “Sounds/hit.wav”.

public bool Hurts(string? layer)

True if it hurts things on collision layer layer.

public float RollDamage()

The damage of one hit: DamageRoll rolled, or Damage.

public event Action<Entity>? Hit

Raised with each hit, with what it hit.