Emulating EarthBound’s Scrolling Damage System

Scaerietale
2 min readFeb 6, 2024

--

A random, passing thought in one post

This is quite literally one of those shower thought, bolt from the blue random thoughts that, I don’t know about neruotypical people, but genuinely plague my ADHD-addled brain sometimes. I once read a post somewhere, asking for advice on recreating EarthBound/Mother 2’s scrolling damage battle system. Rather than try to track down that no doubt multi year old post, I thought I’d write up a small blog entry about it.

If you’re not familiar with the game, your character’s hit points (or health points, if you prefer) and PSI Points (equivalent to MP/Magic/Mana) Points, rather than instantly being removed, tick down over the course of a fight after each action relating to them.

For example, if a Spiteful Crow pecks at Ness’ eyes for 10 damage, it’s not instantly taken off Ness’ 30hp, but scrolls down rapidly. The trick is, if the battle ends, then the ticker stops moving. So in later battles, with a lot more HP involved, you can stop a party member from otherwise dying if you manage to finish the fight before their HP wheel scrolls to zero.

Ness and Paula battle a Spiteful Crow. Copyright: Nintendo

The real trick is getting it to work in terms of code, which you could accomplish, for example, using a series of loops.

For example, you’d have a While loop that gets triggered in the background on an interval of every, say, 1/10th of a second, the character takes a percentage of the damage, or in EarthBound’s case, it would be a constant for loop counting down:

for (int i = 0; i < enemyDamage; i++) {
charHealth -= 1;
}

Then the trick just becomes ending the damage ticks if the battle ends, something like:

while (fighting) {
for (int i = 0; i < enemyDamage; i++) {
charHealth -= 1;
if (!fighting) {
break;
}
}

All this of course takes into account assumptions that are beyond the purview of this post, like that you’ve either accounted for, or that your game engine accounts for, things likde delta time.

I’m just posting this as a vague and extremely generic, extremely simple example of how one might go about emulating that very unique combat style.

Hope someone found this useful, or at least vaguely interesting! ❤

--

--

Scaerietale
Scaerietale

Written by Scaerietale

I am a legally blind musician, author, programmer, and ADHD advocate

No responses yet