Spielerando

Charge Attack

A charge attack builds power while the attack button is held and strikes when it is let go. A quick tap is an ordinary attack, a longer hold hits harder up to a full charge, and the character is slower while charging. A hit that lands during the charge breaks it and staggers the character.

Also called: Charged shot, Hold to power up, Heavy attack.

A stocky badger braced on a cliff edge holds a huge stone mallet far behind its head, the head glowing with a full ring of amber light, while a stone golem waits across a narrow chasm.
Tarnwick Deep, an invented linocut-style brawler. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Charge Attack" to my game.

What it should do: A charge attack lets the player trade time and safety for power: a stronger strike for anyone willing to stand still, slowed down and open to being hit.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> ready
  ready: Ready
  charging: Charging
  full: Fully charged
  recovery: Recovering
  staggered: Staggered
  ready --> charging: attack pressed
  charging --> full: charge fills up
  charging --> recovery: button let go
  full --> recovery: button let go
  charging --> staggered: hit breaks charge
  full --> staggered: hit breaks charge
  recovery --> ready: recovery is over
  staggered --> ready: stagger is over
```

Use these starting values:
- chargeTime: 1.2 s
- tapTime: 0.2 s
- baseDamage: 10
- maxMultiplier: 4 x
- recoveryTime: 0.4 s
- tapRecovery: 0.2 s
- staggerTime: 0.5 s
- moveShare: 0.4

Watch out for these common mistakes:
- Holding on after the charge is full: Tell your AI: stop counting at a full charge. Holding on adds nothing, and the character stays fully charged until the button is let go or a hit comes.
- A hit and a release in the same moment: Tell your AI: decide from how the tick began. A hit during a charge always wins, and the strike is lost.
- Holding the button through the recovery: Tell your AI: a charge only starts on a fresh press. A button that is already down when the recovery ends does nothing.
- A tap that counts as a tiny charge: Tell your AI: a hold shorter than the tap time is an ordinary attack with the short recovery.
- Charge speed that depends on the frame rate: Tell your AI: add the time each tick covers, never a count of ticks.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

A charge attack lets the player trade time and safety for power: a stronger strike for anyone willing to stand still, slowed down and open to being hit.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

attack pressedcharge fills upbutton let gobutton let gohit breaks chargehit breaks chargerecovery is overstagger is overReadyChargingFully chargedRecoveringStaggered
How it runs, as a diagram
  • Ready → Charging: attack pressed
  • Charging → Fully charged: charge fills up
  • Charging → Recovering: button let go
  • Fully charged → Recovering: button let go
  • Charging → Staggered: hit breaks charge
  • Fully charged → Staggered: hit breaks charge
  • Recovering → Ready: recovery is over
  • Staggered → Ready: stagger is over

Good starting values

ValueStart withWhat it changes
chargeTime1.2 sTime to a full charge. Long enough that waiting for it is a real risk, short enough that players will try it.
tapTime0.2 sA hold shorter than this is a tap and gives an ordinary attack. It must stay below the time to a full charge.
baseDamage10The damage of a tap, and where the climb starts for a charged hit.
maxMultiplier4 xHow many times the plain damage a full charge deals. Four times pays for more than a second of risk without making every other attack pointless.
recoveryTime0.4 sThe wait after a charged strike before the next attack. A big hit that can be followed at once has no cost.
tapRecovery0.2 sThe wait after a tap. Shorter than after a charged strike, so ordinary attacks still feel quick.
staggerTime0.5 sHow long a hit during the charge leaves the character helpless. It is the price of being caught.
moveShare0.4The share of normal speed while charging. Zero stands still, one gives no slowdown. Slow enough to feel the weight, fast enough to keep aiming.

What usually goes wrong

Holding on after the charge is full

If the damage keeps growing with the time held, a player who waits long enough one-shots everything, and the weapon stops being balanced against anything.

Fix: Tell your AI: stop counting at a full charge. Holding on adds nothing, and the character stays fully charged until the button is let go or a hit comes.

A hit and a release in the same moment

If the release is handled first, the player strikes a split second after taking a hit that should have broken the charge. If the hit is handled first but the strike still goes out, the charge was never really broken.

Fix: Tell your AI: decide from how the tick began. A hit during a charge always wins, and the strike is lost.

Holding the button through the recovery

A player who keeps the button down after a strike starts a new charge the moment the recovery ends, without ever pressing again. That makes the slow character charge all the time by accident.

Fix: Tell your AI: a charge only starts on a fresh press. A button that is already down when the recovery ends does nothing.

A tap that counts as a tiny charge

Without a tap threshold, every press has to wait through the slowdown and the long recovery, and quick attacks feel as heavy as charged ones.

Fix: Tell your AI: a hold shorter than the tap time is an ordinary attack with the short recovery.

Charge speed that depends on the frame rate

If the charge is counted in frames instead of seconds, a computer running twice as fast charges twice as fast, and the same hold gives different damage.

Fix: Tell your AI: add the time each tick covers, never a count of ticks.

How to check it works

Works well with

Clashes with Combo System: A chain wants quick presses, and a charge wants one long hold on the same button. Let a tap feed the chain as usual, and start a charge only when the button is still down after the tap time.

Variations: Charge Jump.

Common questions

what do i tell my ai to add a charge attack

Paste this: Add a charge attack. Holding the attack button charges for up to 1.2 seconds and letting go strikes. A hold under 0.2 seconds is an ordinary attack. Damage climbs in a straight line from 10 to 40, holding longer adds nothing, the character moves at 0.4 of its speed while charging, and a hit breaks the charge and staggers the character for half a second.

how long should a charge attack take to charge

A little over a second is a good start. Shorter and the charge is just the normal attack, longer and players stop using it because the fight is over before it is ready.

should a charge attack slow the player down

Yes, a little. Slowing to about 0.4 of normal speed makes the commitment visible and keeps the player able to aim. Standing completely still makes the charge feel punishing.

what happens if the player gets hit while charging

Here the charge is lost and the character is staggered for half a second. Without that, charging has no risk and every player charges all the time.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it