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 / Making simple gravity

Author
Message
Regnuar
17
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 23rd Feb 2010 18:02
Hello, once again

I'm trying to make simple gravity/collision system, but without success. I tried to make;



with that, i didn't even get player to warp. Any ideas how to fix this kinda problem?
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 23rd Feb 2010 18:04
Use sparky's collision, it's a lot faster and more precise.

Also I need to see some more code that that.

If it hasn't exploded yet, I haven't touched it.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 23rd Feb 2010 19:49
Quote: "i didn't even get player to warp."

What is "warp"?
Your code looks fine from what I can see.... We do need more of the code to be sure your not screwing yourself with the values somewhere..... Also, unless you are strictly controling the frame rate, you SHOULD use time as a factor in your physics. You have my sympathy if you don't like to use other people's code to accomplish something you want to do yourself, but in some cases you may just have to give up and accept it as a gift from the programming gods.

The fastest code is the code never written.
Pharoseer
19
Years of Service
User Offline
Joined: 21st Feb 2007
Location: Right behind you
Posted: 24th Feb 2010 04:40
Are you actually changing ypos# each update with the new/current y position? Something like:



If not, your position will only vary by plus or minus 0.5 from your starting value.

Also, I agree with Madscientist, Sparky's DLL is very fast compared to the built-in commands.
Regnuar
17
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 24th Feb 2010 10:34 Edited at: 24th Feb 2010 13:45
I'm not at home, but in the thing is something like this;



this should be enough.

I'v installed the Sparky's DLL and i'v tried it few times but never got the sparkys code working. could someone give one piece of working code from sparky's to check i'v installed it right.

Cheers
edge ogg
16
Years of Service
User Offline
Joined: 20th Feb 2010
Location: cornwall
Posted: 24th Feb 2010 10:53
this should work
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 24th Feb 2010 14:35 Edited at: 24th Feb 2010 14:36
To get sparkey's code to work, go into the Downlaoded Collision Folder and copy and paste SC_Collision.dll into the Dark Basic Professional\Compiler\plugins-user folder.

Also, You never set player to =1

If it hasn't exploded yet, I haven't touched it.
Regnuar
17
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 24th Feb 2010 15:42 Edited at: 24th Feb 2010 15:43
i always do, everything else is defined into groups for example trees are 200-299. I don't know what's the big deal if player is object number one, so please tell me. I'll check the sparky's dll directory right'o way and try once more.
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 24th Feb 2010 19:39 Edited at: 24th Feb 2010 19:42
Well it can really just be any number but you need to declare it which you didn't do in the code you provided.
Use this instead.


If it hasn't exploded yet, I haven't touched it.
Regnuar
17
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 25th Feb 2010 21:29 Edited at: 25th Feb 2010 21:30
Ok, i think sparky's collision is now installed to right place, gonna read one tutorial tomorrow and hope i learn how to use it. Thank you for answering and sorry for being idiot

oh and i copied the code from above and forgot to make variable for the player

Login to post a reply

Server time is: 2026-07-28 06:35:17
Your offset time is: 2026-07-28 06:35:17