Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / More advanced collision dtection [2d]

Author
Message
ErDa
16
Years of Service
User Offline
Joined: 17th Feb 2008
Location:
Posted: 1st Apr 2008 18:05
I'm working on a 2d eagle-eye view game, and i need some sort of collision-detection for the walls. It'd take ALOT of work to write


As well as having to dbSprite() in every piece of wall. The very best would be some way to check for the color of the pixel infront of the character, and deny movement if it's of, say, red color.

However i have no idea on how to write a color-check.
Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 2nd Apr 2008 01:40
I'd write an environment collision function for that:



I brutally simplified that, but if you store the rectangles of walls as objects, then use an array of pointers to those objects to access them all from one collision function, it should be easy to check if the object you're passing into the function is overlapping any of the walls or not. And since this is a loop, you only have to program it for one object and one wall, then it will check all of them.

Login to post a reply

Server time is: 2024-09-29 17:25:41
Your offset time is: 2024-09-29 17:25:41