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.

Dark GDK / sparkys collision help

Author
Message
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 16th Sep 2009 00:08 Edited at: 16th Sep 2009 00:09
when i try and compile my game it says error during setup object(1) not found after it creates the window for the game


nevermind i figured it out lol
lil marioman
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: Canada
Posted: 16th Sep 2009 00:12
You setup collision for object 1 BEFORE you made the object. Same goes for object 2.

Programming? Not my Forte. But THAT is!
-insert picture of a KIA Forte here-
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 16th Sep 2009 00:18
i know i figured that part out but what would be the best way to have a player stop moving when colliding with something in the level?
lil marioman
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: Canada
Posted: 16th Sep 2009 04:51
Well you can look at the Sliding Collision Demo included in Sparky's Collision. I know a lot of people say this, but it's true. I've implemented that code in my own game, and it works beautifully. (Now I gotta get the AI working )

Study the code till you get the gist of it, then try your luck at implementing it.

Programming? Not my Forte. But THAT is!
-insert picture of a KIA Forte here-
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 16th Sep 2009 23:29
lol ok thanks and good luck with the AI
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 19th Sep 2009 05:39 Edited at: 19th Sep 2009 05:40
ok ive tried for a few days now and i cant figure out how the collision works im really lost if anyone could give me a simple tutorial on how to get two objects to collide and stop that would be great
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 20th Sep 2009 07:42 Edited at: 20th Sep 2009 07:44
Ive been using two functions to handle collision. one to load the object and the other from the sliding demo



The collision code has been made more user friendly(its still the sliding demo but i changed a few things here and there).Just pass int the object's ID that you want to collide with the level. Also my groups are the same as in the demo.

dont forget to declare: (if i let out any there still in the demo)



NOTE* i also removed the movement handling from the function and im not sure if you can just add it back in but its worth a shot
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 20th Sep 2009 20:09
thank you this helps a lot ill see if i can get it working in my game
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 24th Sep 2009 03:07 Edited at: 24th Sep 2009 03:34
i keep getting link errors when i try to compile here are the errors and my code



nevermind i got it
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 24th Sep 2009 03:32
a common C++ mistake .
In you declaration you have

it should be


if you don't see the difference , it is that you declared the function with a lowercase 'c' and defined it with a capital one 'C' . so change either one of the c's and that should do it.

PS: in the void Collision, where it references dbObjectPositionX,Y,Z() you should pass in 'iID' instead of '1' . That way you wont run into problems later when you want to use it on another object
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 24th Sep 2009 03:44
yeah i noticed that lol but i cant get it to detect collision between my player and the level now he just falls through heres my new code
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 24th Sep 2009 04:02 Edited at: 24th Sep 2009 04:03
in your level setup , you have your map and player in the same group so when it checks for collision between the two, it doesn't happen. so change it to this

Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 24th Sep 2009 06:13
ok sorry to keep doin this but i changed dbMakeObjectCube(2, 2 ) with dbLoadObject( "test level .3DS", 2 ) and now my camera is stuck in one position and the player falls through the level again
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 24th Sep 2009 07:56
did you change the SC_SetupObject(2,0,2) -> SC_SetupObject(2,2,2);

also you may want to try SC_SetupComplexObject(2,2,2);
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 24th Sep 2009 09:19
SC_SetupComplexObject(2,2,2); sort of works but now the player just slides off the level even if the collision function isnt being used and the X coordinate isnt being updated it stays the same the level is just a flat plane
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 24th Sep 2009 22:46
try using a sphere instead of a cube(just a long shot), or it may be that your using a .3DS which i've never used. the code itself works fine for me.
Patrick987
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 1st Oct 2009 07:03 Edited at: 1st Oct 2009 07:46
yeah that didn't work ill try it with a .x file and see if that works

edit it works fine now with the .x file thanks for all the help

Login to post a reply

Server time is: 2024-10-01 14:43:23
Your offset time is: 2024-10-01 14:43:23