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.

2D All the way! / Sprite collision with color??

Author
Message
GSX R
20
Years of Service
User Offline
Joined: 19th Jan 2005
Location:
Posted: 20th Jan 2005 04:49
Is there any way to make a sprite collide with a background color?

Lets say you load an bakgound map that scrolls and want a sprite to collide with green borders, how do I do that? Is it posible?

Thanks!
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 20th Jan 2005 11:06 Edited at: 20th Jan 2005 11:07
Yeah, it can be done. It's not hard, but it's not the best way either.

You'd use the POINT(X,Y) command to return the color value of a pixel on the background. If the return value is equal to that green color then you'd trigger your collision routine.

GSX R
20
Years of Service
User Offline
Joined: 19th Jan 2005
Location:
Posted: 21st Jan 2005 09:16
Thx, will try to get it to work...
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 22nd Jan 2005 16:56
Weird, I thought I posted some code showing you how to do this...Oh well, here goes.

Try this...Ofcourse you'll need to set the x,y coords and you'll also need to feed the RGB command the color. You'll also want a more signifigant set of insturctions other than the text one I've used.

IF POINT(x,y)=RGB(0,0,0)
TEXT 0,0,"Collision!"
ENDIF

Login to post a reply

Server time is: 2025-05-18 05:47:20
Your offset time is: 2025-05-18 05:47:20