d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Collision Detection For My Game > I Need Help
Add Reply New Topic New Poll
Member
Posts: 1,358
Joined: Mar 6 2011
Gold: 237.00
Jan 22 2014 11:51pm
Hey guys, I'm making a street fighter type game with sprite sheets and such, but my collision detection for my punches and kicks is off because of how wide the sprite sheet image is. Could I possibly make a collision detection with color, placing the color on top of the fist in the sprite sheet so whenever the color on the fist collides with the other player the health goes down?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 23 2014 12:26am
Sure. alternatively if you can treat your sprites as polygons. if the polygons overlap then it's a collision. or if it's a straight punch, check if the tip of the fist is inside the opponent's polygon.

Actual implementation depends on what language/framework you're using.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jan 23 2014 06:31pm
Quote (manbearpig184 @ Jan 23 2014 09:23am)
Hey I'm using java for my game  :thumbsup:


Stick to the topic. What framework are you using?
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Jan 31 2014 05:57pm
Collision detection is always fun. I know I am late to the game, but if you are still messing around with this I would like to expand on what carteblanche was talking about.You mentioned sprites, so I am assuming your "world" is a 2D plane. In this case, you can construct a "bounding box", which would be a polygon, around each sprite. Once this is achieved, using a bit of computational geometry you can determine at which point either of the polygons intersect each other. At the point of intersection would be your collision detection.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll