I'm currently working on a top-down 2D game, roughly similar to something like Zelda for the SNES.

Certain game entities such as the player or a typical enemy will consist of multiple collision boxes. For example:

  1. The main collision box which determines collisions with the map (i.e. walls). It also determines where the entity can be hurt.
  2. The attack collision box which, if overlapping a main collision box, causes the owner of that collision box to take damage.

The attack collision box should only be active when the entity is actually attacking.

One Solution

The first potential solution that comes to mind is the one used in fighting games where every frame of animation has its own set of collision boxes. This can obviously work, but it feels like it may be too over-engineered for what I need.

The Actual Question

Other than the solution above, is there a standard or common approach for attack collision boxes? Or is having collision boxes tied to animation the standard way of doing things?

I would like to emphasize the term "standard". It would be great to know how games like The Legend of Zelda, Secret of Mana, and Castlevania handle it.


I wouldn't use any permanent collision box that's moved around or anything similar.

Instead, just play the attack animation and pick one specific frame where you're looking for collisions inside a specific area.

Since I assume the overall attack animation will be rather short/fast, there shouldn't be any way to notice any difference.

For example, the Gameboy Zeldas had like 3 frames for their sword attacks, which is all you need. If you're going for those three frames (sword horizontal, sword diagonal, sword vertical), do the collision check in the second frame and you should be fine. Once the sword is pulled, you can use another simple rectangle that's active while the sword is out.

I've tried to mark the area where I think they collide (or you could do your own checks) in red:

Link attacking (from The Legend of Zelda: Link's Awakening)

You don't need any more complex collision boxes or collision shapes, unless you're doing it very high res, but even then it's most likely hardly noticeable. Keep in mind that the games you've mentioned all worked on classic systems that had only a limited amount of computation power, so pretty much all of them will only utilize simple collision shapes and only in some very rare examples (like brawlers) anything more complex.

I'm not 100% sure how the actual games implemented their collisions, but at least for the Zelda games I'm sure you've got two or three different rectangles (the first frame might not have one, never bothered testing).

In a similar way, the classic Castlevania games only used two rectangles during the attack animation (first behind the player while swinging the whip, then one in front for the actual attack).

It's been a while since I've played secret of mana, but again I'm rather sure they just use simple rectangles for this, nothing complex. This is obvious with longer range weapons like the spear or whip: You're often able to hit enemies despite there being no clear collision between the graphics and the enemies.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .