00:00
00:00
Newgrounds Background Image Theme

Ryor just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Hit Detection With Blits (as3)

933 Views | 1 Reply
New Topic Respond to this Topic

Hit Detection With Blits (as3) 2012-04-23 19:44:34


Alrighty so I got blitting down extremely well, its efficient and can handle over 1000 or so objects on screen. However, there is going to be a point where these objects, in my case "bullets" are going to hit the player. I've searched far and wide through many hit detection algorithms and safe to say I'm a bit lost with it all. This is in the theme of a danmaku shmup : Example

Brute forcing will simply just not work. I need some advice as to what algorithm I should use. I've contemplated using "buckets" and I've implemented it to the best of my abilities, but it needs more work.

Any advice?

Response to Hit Detection With Blits (as3) 2012-04-25 23:34:02


At 4/24/12 02:59 AM, PSvils wrote: How hard is it to simply get the distance between 2 objects, and check if it is smaller than their combined radius?
Or hell, use a circle as the collision shape for bullets, and a rectangle for the other objects, that should fit their shape I guess a bit better.

That^

Also, if you're really making a Touhou like game the player's hitbox is only one pixel, making your calculations even easier, just test the one centre pixel against the bullet's hitbox (which is normally a tad smaller then it looks)

Although circle based collision my not work. Seeing that you'll need to be very accurate in a game like this, you could do circle based collision to see if a bullet is very near the player, if so use a more extensive hitTest method to check if there is an actual collision.


If ya have something to say, PM me. I have a lot of time to spare.

Also never PM egg82.

BBS Signature