GP32 Need help on collision detection using CHN's...


Mindar

Member
Joined
Apr 8, 2003
Messages
143
Age
34
Location
Florida
Website
www.subquantumsoftware.com
I was wondering if someone could give me an example algorithim of how to block a main sprite from going on top of, lets say, a house or bush. Right now Im trying to figure out how to do it using tilemaps with different colors for collision. But im straining my brain trying to figure out how to make it detect the color, and prevent the main sprite from moving on it.

Thanks! :lol:
 
colour=screen.ptbuffer[(300-y) + (x*300)];

300 * 300 being the screen size in this case, 'screen' is the name of your screen.

colour will = the touched colour.

-Craig

www.gbax.com
 
thanks, I get what your saying, but, heh, what would be my screen name? ;)

So far, this is what I have:
Code:
if (0xC4 != screen.ptbuffer[(MAPH-y) + (x*MAPW)])
{
       HandleInput();
}

Im not sure if im using what you gave me in the right context. I replaced your "color" with the color from my pallete that I want it to collide with.
And handle input is the function that moves the sprite.

I tried replacing screen with various things but it keeps giving me this: "
gpmain.c: In function `GameEngine':
gpmain.c:92: request for member `ptbuffer' in something not a structure or union"

Thanks,
somone help :D !!
 
Find my defender example code, it uses colours for collisions.

I think its on gp32emu.com, or if you got your gp32 from me its on the CD in the DEV dir along with loads of other examples.

-Craig

www.gbax.com
 
Back
Top