Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Character collision systems   Message List  
Reply | Forward Message #14797 of 15019 |
RE: [gbadev] Character collision systems


Another way to do it is to have all of your sprites in X-sorted and Y-sorted
linked lists. The list only changes when one sprite moves past another one,
or when you add/remove a sprite, and you only have to change a couple of
pointers when that happens. But the big benefit it gives you is that you
know exactly what the closest sprite in the X and Y direction is, so you
only have to look at the closest couple of sprites in each direction, and
only when a sprite is moving.

> -----Original Message-----
> From: Phantasm4489 [mailto:phantasm4489@...]
> Sent: Sunday, October 03, 2004 6:15 AM
> To: gbadev@yahoogroups.com
> Subject: RE: [gbadev] Character collision systems
>
>
>
> You could use the two techniques you describe at the same time, by having
> a
> collision map which is of a lower resolution than the spite movement.
>
>
>
> so have a collision map which is say on eight pixel boundaries and each
> time
> an object moves you write the object number into the collision map at the
> relevant place.
>
> Then you will know which sprites you need to check rather than looping
> through all of them.
>
>
>
> Depending on the size of the collision you choose, you may also have to
> consider that there could be more than 1 object in any location.
>
> _____
>
> From: Palamon 3 [mailto:palamon_3@...]
> Sent: 03 October 2004 04:37
> To: gbadev@yahoogroups.com
> Subject: [gbadev] Character collision systems
>
>
>
>
> Hi,
>
> I've been trying to figure out a good way to detect if
> two objects touch each other in an action game like
> mario brothers.
>
> The first game I am making, I wanted to take the easy
> road so I have the sprite characters simply move in 8
> pixel increments, so they always stop aligned with the
> background tiles, just like in the Pokemon games. I
> keep track of the different sprite characters through
> creating a big 2d array about the size of the
> background array, and I simply keep track of where the
> different sprite characters are by putting markers on
> the game map based on their xy coordinates so is is
> easy to see if they collide with anything by simply
> checking the xy coordinates in the map array that is
> right next to the other sprite character.
>
> It's an easy and quick way to keep track of the
> different locations and see if the different sprite
> characters collide with each other, etc.
>
> However this only works for games that have only a few
> set spots where the sprite characters can be, not
> games like mario and other action games where your
> character can move pixel by pixel. I'm afraid the map
> array becomes too big to be the best option for the
> job, plus you have to fill up every pixel of the map
> array that the sprite takes up, which will slow it
> down.
>
> The only other option I can think of is to scroll
> through a list of all the sprites on screen and check
> their xy coordinates and the sprite width/height to
> see if it overlaps the sprite character you are
> checking to see if those sprites collide or not. I'm
> hesitant to do this because I'm afraid it will be too
> slow when the sprite list is a little large since it
> has to run though all the sprite characters and their
> positions every time something moves.
>
>
> I was wondering what programming techniques you all use.







Mon Oct 4, 2004 9:08 pm

the_real_tho...
Offline Offline
Send Email Send Email

Forward
Message #14797 of 15019 |
Expand Messages Author Sort by Date

Hi, I've been trying to figure out a good way to detect if two objects touch each other in an action game like mario brothers. The first game I am making, I...
Palamon 3
palamon_3
Offline Send Email
Oct 3, 2004
12:48 pm

You could use the two techniques you describe at the same time, by having a collision map which is of a lower resolution than the spite movement. so have a...
phantasm4489
Offline Send Email
Oct 3, 2004
1:46 pm

Another way to do it is to have all of your sprites in X-sorted and Y-sorted linked lists. The list only changes when one sprite moves past another one, or...
Jesse McClusky
the_real_tho...
Offline Send Email
Oct 5, 2004
12:16 pm

That's a really good idea, (I'm still wondering how come I didn't come up with it on my own :) ) But after some thought, I'm just wondering how to implement...
Palamon 3
palamon_3
Offline Send Email
Oct 7, 2004
10:09 pm

... <snip> The Y sorting is good if your game uses a 2D field. If it's simply a platformer, such as Mario, you can get away with sorting just the axis you're...
Jesse McClusky
the_real_tho...
Offline Send Email
Oct 8, 2004
12:33 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help