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.

Newcomers DBPro Corner / problems with gravity / jumping and walking (they wont work when put together!!)

Author
Message
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 16:48
ok ive taken several parts of codes from the forums and probably one of them doesnt like the others
here it is (media attached)
it also doesnt like me choosing where the model spawns



Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8

Attachments

Login to view attachments
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 20th Jul 2008 20:01 Edited at: 20th Jul 2008 21:55
Okay. I'm not exactly sure how your code works, but I made some functions a while back that do collision and jumping with the DLL if you'd like to try those. They may be hard to learn from due to the fact that they're a little buggy and pretty messy with very few REM statements .

Example With Functions:


It may be a good idea, for learning purposes, to keep trying on your own though

Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 20:10
awsome just what i needed!
=) <- happy
have a cookie
sorry i had a bite because it looked so tastey



Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 20:18
what do i do if i want to just make that ball collide with a map
the map being a .x

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 20:24
and i get errors when i try to remove the blocks

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 20th Jul 2008 21:40 Edited at: 20th Jul 2008 22:05
I'm glad you liked the functions . There are some bugs in them... Anyway, I will explain my functions to you.

****************************************************************

COLLSetupObject(MaxOBJ)
-Sets up the collision system. Call this at the top of your program.
MaxOBJ- The highest object number you will ever use for any collision-using objects in your project.

COLLUpdateOld(Obj,Gravity#)
-Updates your object's old position. Do this BEFORE you move your object.
Obj- The object number of the object you are updating.
Gravity#- How powerful the gravity is.

COLLUpdateNew(Obj)
-Updates your object's new position. Do this AFTER you move your object but BEFORE you call the COLLHandleCollision function.
Obj- The object number of the object you are updating.

COLLHandleCollision(Obj,Group,Radius,Offset,Terrain Collision?)
-Actually positions your object based on the old and new positions gathered by COLLUpdateOld and COLLUpdateNew.
Obj- The object you're handling collision for.
Group- The group number you want to check for collision against.
Radius- The radius of your object's collision sphere.
Offset- The Y offset of your object's collision sphere.
Terrain Collision?- Never got this working... just set it to 0.

COLLJump(Obj,Height,Key)
-Allows an object to jump a certain height only when a certain key is pressed and they are on the ground. Just call it each loop and you should be ok.
Obj- The object that will be jumping.
Height- The height of that object's jump.
Key- The scancode number of the key that will trigger jumping. Each key on your keyboard has its own number. The spacekey's, for example, is 57.

COLLCompJump(Obj,Height)
-Does the exact same thing as the COLLJump function but does not take a key input. When you call this, the object will jump if it can.
Obj- The object that will be jumping.
Height- The height of the object's jump.

****************************************************************

Here's how your code should look. (This won't run, it's just to show what should happen.)



And make sure to have this code at the end of your program:



I hope this helps! If you'd like an example with a .x model just ask. Good luck

If you don't know how to call a function, you can read this tutorial I wrote : http://forum.thegamecreators.com/?m=forum_view&t=87472&b=7




EDIT: I changed your old code to use the functions, although they aren't too great with terrain :


Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 22:45
ill give you another cookie as cookie payment

and heres some cookie love songs from BB
http://youtube.com/watch?v=2MTuSx13Wos
http://youtube.com/watch?v=obs_xsZ4q9Q&feature=related

ill try that out while you eat your cookies to the cookie love song

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 22:48
my block just walks through the terrain
=(
ill take that cookie back

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 22:49
before my thing would collide witht he terain but just not be able to jump or have gravity propily

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 20th Jul 2008 23:01
The last piece of code I posted didn't work? Hmm...

Which version of DBP are you using? I've got 6.6 because the other ones bugged out my game... Or maybe we have different versions of Sparky's Collision DLL?

Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 23:04
i got 6.9 and
i think its 2.0 it doesnt say

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 21st Jul 2008 00:02
The version difference may be it. v6.9 made some major negative changes to my game so I had to downgrade. It seems to be working for you though. But you ran this code:

and it didn't work? Strange... It works fine here.

Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 21st Jul 2008 00:22
no the block walks through the terrain

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 23rd Jul 2008 17:16 Edited at: 23rd Jul 2008 17:42
ok this is good AND bad
i was playing around with another code somewhere

ok heres the problem
if you walk up a slope you fall through the world!!!!
i have to jump up slopes lol
but at least the collisions work

but i can walk on flat surfaces just aslong as there not going up



Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 23rd Jul 2008 17:17
im sure its to do with something like
terrain height or somthing
but i dont know

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
pirate
18
Years of Service
User Offline
Joined: 18th Apr 2006
Location: u.s.a
Posted: 1st Aug 2008 19:57
this code is by rohan...i have been using it for a good while and it works great...i modified mine to use the mouselook but this is rohan's original code from the code snippits....maybe it can help you...



thanks, pirate

Login to post a reply

Server time is: 2024-09-27 18:23:35
Your offset time is: 2024-09-27 18:23:35