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 / Still confuse..... how annoy...

Author
Message
Jedi Lord
21
Years of Service
User Offline
Joined: 11th Jun 2004
Location: Jedi Temple
Posted: 6th Sep 2005 07:47
I am still confuse with sliding collision, even with the help of codes....

Let's go to school! yay... hello... HELLOOOOO......
Dimension
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 6th Sep 2005 08:50
Try newton(do a search on forums its a library)
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 6th Sep 2005 10:59
I personally think that if you use something like newton without knowing how or why it works, you'll probably end up running into other problems that'd be even harder to solve...

My Website:
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 6th Sep 2005 12:25
Nuclear Glory is the best bet for simple sliding collision.

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Sep 2005 12:55
These plugins can be scary, I would'nt say either was easier to use - they're both approachable with experience but it's unthinkable to start off using this stuff before you know how it works. Really, you should start by learning the most basic form of sliding collision, a simple 2D axis collision.

Now I'd always use a passed location to a function to check collisions, so I might have a function called Colcheck, which I'd pass the collision location to, and it would return the result of the check. With a 2D system you can hard code the collision zones, or use a grid, whatever suits. This is a little example using simple hard-coded collision.

PX#=100.0
PZ#=100.0

Do
cls
`We need the last location
opx#=px#
opz#=pz#

`And the new location
if upkey() then dec pz#,1
if downkey() then inc pz#,1
if leftkey() then dec px#,1
if rightkey() then inc px#,1

`Is there a collision at px,pz
If colcheck(px#,pz#)=1
`is there a collision at the new X and old Z location
if colcheck(px#,opz#)=1 then px#=opx#
`is there a collision at the new Z and old X location
if colcheck(opx#,pz#)=1 then pz#=opz#
endif
cente text px#,py#-5,""
Loop

Function colcheck(x#,z#)
colcheck=0
if x#<50 then exitfunction 1
if x#>150 then exitfunction 1
if z#<50 then exitfunction 1
if z#>150 then exitfunction 1
Endfunction 0


This little example should show a smilie face that can move within a square on the screen, but with slidey collision. Replacing that simple boundary check with something more useful would be a good start, maybe a tile system with collision to practice on - 'tis all useful stuff to know.


Van-B

Put those fiery biscuits away!
Jedi Lord
21
Years of Service
User Offline
Joined: 11th Jun 2004
Location: Jedi Temple
Posted: 8th Sep 2005 06:30
I think I found the problem solved, maybe I can buy the new commands for darkbasic and it will help me make better collision.
Will it work?

Let's go to school! yay... hello... HELLOOOOO......
Darkbasic MADPSP
19
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 9th Sep 2005 19:55
Buy don't you mean download the upgrade that features all the new commands

New dbpro site unleashed go to
http://www.freewebs.com/darkbasicpro
Jedi Lord
21
Years of Service
User Offline
Joined: 11th Jun 2004
Location: Jedi Temple
Posted: 2nd Oct 2005 07:06
No, the new plug-in that will help me get better collision codes.

Let's go to school! yay... hello... HELLOOOOO......
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 2nd Oct 2005 07:08
Gimme TEH CODEZ

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
http://dbworlds.darkuniverse.net/
Raven
20
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 2nd Oct 2005 07:47
There's an example of sliding collision in the help, examples, old darkbasic tutorial (monster hunt) available on the site, etc.

plenty of examples. the concept isn't really too hard.

Login to post a reply

Server time is: 2025-06-12 10:57:07
Your offset time is: 2025-06-12 10:57:07