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 collision help

Author
Message
Beyond the Humans Knowledge
12
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 25th Dec 2010 05:36
This is my code and i dont know how to make it to where if i collide with sprite 2, then i stop as if it were a wall.



onhcet d(-_-)b techno
flashing snall
17
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 26th Dec 2010 06:33

box 0,0,20,20
get image 1,0,0,20,20
sprite 1,0,0,1
sprite 2,100,100,1
do
sprite 1,mousex(),mousey()
if (spritecollision(1,2))
end
endif
loop

Beyond the Humans Knowledge
12
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 26th Dec 2010 07:30
first off, i tried it and it says i dont have spritecollision as a variable anywhere. second, i edited it to where its
[/code]
if sprite collision(1,2)
end
endif
[code]

and it just ends the program?

onhcet d(-_-)b techno
Kevin Picone
20
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 26th Dec 2010 11:23 Edited at: 26th Dec 2010 11:29
Sprite Collision is a function in the sprite command set. So that seems like a good place to start looking when after information on doing sprite collisions

flashing snall
17
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 26th Dec 2010 16:13
yea sorry Beyond I just wrote that up on the spot. I havnt used dbpro 2d commands in a long time, but like Kevin said, look into the sprite commands and you should be set to go.

Keep in mind those commands will only detect a collision between the bounds of an image, and not really where the drawing within the image ends. If you want pixel perfect collision, then youll have to get more creative.

Ashingda 27
14
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 27th Dec 2010 00:14 Edited at: 27th Dec 2010 00:14
I'm sure there are a few collision threads here and there, try doing a search. There are many ways to work collisions and it also depends on the type of game it is for. What exactly did you want your two tiles to do, or what kind of game you making?

Beyond the Humans Knowledge
12
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 27th Dec 2010 02:37
im just using them to test collision. i.e. a wall. i dont really have a game in mind considering im still learning about arrays and collision.

onhcet d(-_-)b techno
DeadTomGC
12
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 24th Mar 2011 14:43

Login to post a reply

Server time is: 2022-12-06 03:24:49
Your offset time is: 2022-12-06 03:24:49