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

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? 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 #14796 of 15019 |
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.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com








Yahoo! Groups Sponsor



ADVERTISEMENT

<http://us.ard.yahoo.com/SIG=129vpfoqv/M=315388.5455592.6541275.1666179/D=gr
oups/S=1705055196:HM/EXP=1096894128/A=2372354/R=0/SIG=12id813k2/*https:/www.
orchardbank.com/hcs/hcsapplication?pf=PLApply&media=EMYHNL40F21004SS> click
here



<http://us.adserver.yahoo.com/l?M=315388.5455592.6541275.1666179/D=groups/S=
:HM/A=2372354/rand=177280909>



_____

Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/gbadev/

* To unsubscribe from this group, send an email to:
gbadev-unsubscribe@yahoogroups.com
<mailto:gbadev-unsubscribe@yahoogroups.com?subject=Unsubscribe>

* Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.








Sun Oct 3, 2004 1:14 pm

phantasm4489
Offline Offline
Send Email Send Email

Forward
Message #14796 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