# Should attacks collide with sprite or movement collision shape of actor?

This topic is 2978 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm starting a top-down view action adventure like The Legend of Zelda. To emulate perspective I'm putting the movement collision shape of an actor around its feet instead of over its whole sprite, which will allow actor sprites to overlap each other.

For attacks, I'm wondering what collision shape to test against. Testing against the movement collision circle would be more "correct" but it may be hard for the player to aim when attacking from the north or from the sides. The player would have to be able to judge where the top of the collision circle is. Testing against the whole sprite would make it easier to aim but make actors easier to hit from the side. To allow the perspective overlap, I expect most of my sprites to be taller than they are wide.

##### Share on other sites
You should extend your perspective plan to include the collision and do both. Basically, you should test against an oval (which represents the cylinder in full 3D)

Probably get away with a 2 or 3 circles instead of an oval if you don't like the additional math. The cost of that will not be a bottleneck!

In your diagram the collision circle is centred on the guys gonads. If you put another one on centred on his chest, you'll see what I mean.

##### Share on other sites
Using an oval or multiple collision circles covering the sprite still has the issue that it's easier to hit from the side than the top or bottom since the collision area is taller. Are you saying that you'd be able to live with this?

##### Share on other sites
It's certainly how I've done this stuff in the past and nobody ever complained.

Generally, when dealing with collisions you can get away with quite a lot, as long as any errors or innacuracies favour the player as opposed to hindering him.

I guess a better test would be to calculate how high off the "ground" your bullet is and map the collision circle that high from the characters feet, then do the intersection test. But I'm pretty sure that if you bother with that then only you will notice it. :)

##### Share on other sites
Quote:
 Original post by RubiconGenerally, when dealing with collisions you can get away with quite a lot, as long as any errors or innacuracies favour the player as opposed to hindering him.

Well, in this case, the player would definitely be vulnerable from the side since he'd have a tall sprite. Then again, most of the enemies will have tall sprites too, so I guess it balances out. I still don't like the bias it may put on side attacks though, almost as if I'd rather make a side scroller.

Quote:
 I guess a better test would be to calculate how high off the "ground" your bullet is and map the collision circle that high from the characters feet, then do the intersection test. But I'm pretty sure that if you bother with that then only you will notice it. :)

This would be like having the collision shape of the bullet be below the bullet sprite itself. I've been thinking about doing this anyway but, again, it might be hard for players to judge where and when the bullet would actually hit.

P.S. I said the collision circle is around an actor's feet. Don't take this too literally. I just meant the bottom part of the actor's sprite, not around where the actor's feet would be in 3D. :P

##### Share on other sites
You should just represent each entity's position in terms where its feet hit the ground and, in the case of projectiles, where imaginary feet of an imaginary guy would hit the ground if he was holding the projectile, if you know what I mean.

Is there any true z-component to your game at all? Meaning would it be possible for a projectile to ever go over an entity? If not, given positions defined as above you can just use them directly for collision detection with no other data i.e. height.

##### Share on other sites
There is no actual z-component in my game. I'm not having any issues with handling height though. All collision shapes are separate from the sprites, so I am fully able to arrange things such that they are perspective correct.

I'm just wondering from a game design perspective whether a player would make sense of this. The collision shape for a bullet flying above the ground would be below the bullet sprite, and the region of an actor that can actually take damage would only cover the bottom half of the actor's sprite. In an action game would most players be able to handle this instead of suffer from "faulty collision detection"?

Maybe this question should be asked in the Game Design forum?

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632999
• Total Posts
3009814
• ### Who's Online (See full list)

There are no registered users currently online

×