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! / 2d Sprite Collisions!!!

Author
Message
Nathan C
12
Years of Service
User Offline
Joined: 26th Jan 2010
Location:
Posted: 20th Mar 2010 10:15 Edited at: 21st Mar 2010 10:24
Whenever i try to get two sprites (Person sprite, and a building sprite) to have a collision with each other, it doesnt work! all i want is for my character to walk up to a building and stop because of a collision but cant!!! Im new to programming so i dont realy know what to do. ive tried the Sprite Collision command, the Hit sprite command, and they dont work. Im going to give my source file so somebody can show me what to do. Please somebody help me, it will be greatly appreciated

Here it is:



Link102
18
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 20th Mar 2010 17:31 Edited at: 20th Mar 2010 23:18
please use [code lang=dbp*]<code here>[/code*] without the *

so we can actually read the code.

flashing snall
17
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 22nd Mar 2010 22:58
I didnt see any actual collision there.

DBPro has a built in command called
sprite collision


you can use it one of two ways. First, you can do something like this


that will give you a 1 if sprites 1 and 2 are colliding. However, if you want to open it up some more, you can do



That will give hit the value of whatever sprite is colliding with sprite 1. If no sprite is hitting it, it returns a 0. This means you can have a whole bunch of sprites and check to see what sprite is hitting your player.

Hope that helped... maybe. Now I have to go to work, gr.

Nathan C
12
Years of Service
User Offline
Joined: 26th Jan 2010
Location:
Posted: 23rd Mar 2010 00:06 Edited at: 23rd Mar 2010 05:11
my problem still exists. Ok, what i want is for the WHOLE building to be a solid object so when i walk to it, my character stops. I can get 2 sides of the building solid but not the rest, i have tried multiple time and still don't know what to do.

ive tried these:







and yet i still cant get this to work. its fustrating. and i know that the way i am trying to do this is probably dumb.
Zergei
17
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 27th May 2010 03:58
This should go right after your sprites section and before the control code:



the entire thing would be:



Further on my stuff at...
TurboSquid.com
The3dStudio.com

Login to post a reply

Server time is: 2022-12-09 17:03:20
Your offset time is: 2022-12-09 17:03:20