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 Discussion / 2D Collision question

Author
Message
The Scorpion
17
Years of Service
User Offline
Joined: 12th Oct 2002
Location: United States
Posted: 24th Oct 2002 23:57
I'm having problems with collisions...see I have it test right? so it places the object to it's original position before it collided. Well...if I move the objects pixel by pixel then it is really slow. So i have them move more. But with this then there is a big gap of space between objects when they so called collided. How can I fix this? I have a variable called speed which controls how many pixels the object moves I have a function controlling my collisions. But it seems to me that functions use their own internal variables rather than the global ones. Anyone have any suggestions? (Hmm I guess I was stupid to switch from C++).
Who ever loved that loved not at first sight?
- William Shakespear (genious)
SpiralMinice
17
Years of Service
User Offline
Joined: 14th Oct 2002
Location: United States
Posted: 25th Oct 2002 05:56
yes the variables declaired in DB functions will all be local ones. also you can not call a goto or gosub tag from outside of that function. I asume you're having problems because you have some sort of ground that uses curves or is hilly... cant help you there, but here is some stuff that i've learned about 2d in Db that might be helpfull.

1: because sprites in Db move so slowly... at least on my crap pc, try using the set sprite comand and seting the backsave state to 0 on your sprites then seting the backdrop comand to on, this clears the screen and uses some of DB's 3d capabilites to help with the slowness of the 2d.

2: the sprite collision() comand sucks, because if you are still touching one sprite it will not pick up on the next sprite you touch unless you are no longer touching the previous sprite. so its much better to just create an aray for each sprite's position in your game.

dont know if that was any help. sory if not. if you want more help i've made a prety good 2d collision engine (easily walk up stairs, easily walk on stuff, works well with gravity settings etc..)

Come children and i shall bring you into unlevend
feilds of faraf fo sdlief dnevelnu otni uoy gnirb llahs i dna nerdlihc emoC
The Scorpion
17
Years of Service
User Offline
Joined: 12th Oct 2002
Location: United States
Posted: 25th Oct 2002 23:51
I see what you mean...You didn't help me directly, but you did help me think more clearly about what I should do. Thanks I'll think of a manual system for collisions. I'm doing isometric view with camera scrolling so I don't think any platform engines will help me. Thanks anyways.

Who ever loved that loved not at first sight?
- William Shakespear (genious)

Login to post a reply

Server time is: 2020-08-13 19:07:57
Your offset time is: 2020-08-13 19:07:57