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.

DarkBASIC Professional Discussion / 2d map image boundress

Author
Message
Daniel wright 2311
User Banned
Posted: 17th Apr 2012 20:58 Edited at: 17th Apr 2012 20:59
What would the easy way be to set up wall collision to a image map? My image sprite will be the main player and it can be on the image map but cant go out of the image map nor into the walls in the image.Thanks,here is the image to show what I mean.

my signature keeps being erased by a mod So this is my new signature.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Apr 2012 21:21 Edited at: 17th Apr 2012 21:31
I don't know if there's an easier way but you could try having some invisible (i.e. transparent) sprites positioned to cover the walls. You could then check for collisions with those.

Edit - removed repetition.

Edit2 You might like to look at these threads on pixel perfect collision:

http://forum.thegamecreators.com/?m=forum_view&t=175636&b=1

http://forum.thegamecreators.com/?m=forum_view&t=173612&b=1
Daniel wright 2311
User Banned
Posted: 17th Apr 2012 22:04
@Green Gandalf

Thank you for your help,Its been a long time for me so I am trying to play chech up and I know your right

my signature keeps being erased by a mod So this is my new signature.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Apr 2012 01:50 Edited at: 18th Apr 2012 01:52
With squares like walls it is easy to set up a data collision map.


11111111111111111111111111111111111111111
10000111111111110000111111111111110000111
10000111111111110000111111111111110000111
10000111111111110000111111111111110000111
10000000000000000000111111111111110000111
10000000000000000000111111111111110000111
10000000000000000000111111111111110000111
11111111000011111111111111111111110000111
11111111000011111111111111111111110000111
11111111000000000000000000000000000000111
11111111000000000000000000000000000000111
11111111000000000000000000000000000000111
11111111111111111111111111111111111111111

If you look where the zero's are, that is where you can walk.

Or you can make a colour collision map with rgbr,rgbg, and rgbb.

Daniel wright 2311
User Banned
Posted: 18th Apr 2012 03:39
Thanks for all the help guys but I have decided to use sprite collistion for this.

my signature keeps being erased by a mod So this is my new signature.

Login to post a reply

Server time is: 2026-07-10 09:48:49
Your offset time is: 2026-07-10 09:48:49