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 / how to shoot

Author
Message
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 03:16
is there a function in DarkGDK for shooting? and if there isnt, how would i go about making one?

i have tried to make a shoot function already but to no success:


that didnt work.
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 7th Mar 2009 04:14
what do you want an object/variable to do when you call the function shoot?

...
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 04:25
i want to generate an imaginary line from the gun to wherever its aiming at and then put a bullet hole on the surface it hits.
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 04:26
scratch that last function dw bout it
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 7th Mar 2009 05:10 Edited at: 7th Mar 2009 05:11
Try looking at Sparky's Collision, specifically the ray casting example. It won't tell you everything you want but it'll give you a good idea on how to do shooting so you can expand on it. And for learning purposes it would be better that way then for us just to give you code.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 7th Mar 2009 08:43
Well, I say a good coding tutorial is what you should be looking for.

tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 09:03
is there any tutorials for SC?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 7th Mar 2009 09:30
Based on your post - I'm guessing you might need some more basic instruction than jumping into Sparky Collision.

tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 09:39
like what?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 7th Mar 2009 09:46 Edited at: 7th Mar 2009 09:46
Well...

That's a good question - have you done any looking? I don't know off hand if there are any decent "DarkGDK" primer tutorials, however I DO KNOW that there are alot of DarkBasic Pro tutorials - and even though the languages are different - the names of the commands in DBPro are so close to the DarkGDK "functions" (usually the same names exactly) that by studying the DBPro code - you can see HOW games are put together in general.

Then things like bullets and basic camera, user input and the like will hopefully start to make more sense.... If you can do a few simple programs this way - you'll be all the closer to shooting bullets how you want and ready for sparkys..

--Jason

tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 12:41
i tried this but it didnt work:

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 7th Mar 2009 17:30


Is this a mistake: z,y,z?

SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 7th Mar 2009 18:21
Your function doesn't return a value. Should return the type void, so 'nothing.' ( return; )


My site, for various stuff that I make.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 7th Mar 2009 19:50
Jason P Sage is right, it should be

Also SunDawg i don't think he wants anything to be returned. I think he put it in a function so he can just call that function when ever he wants to shoot rather then copying and pasting all that code.
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 22:16
I just put that function in the LoopGDK() so it gets called once a frame
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 22:19 Edited at: 7th Mar 2009 22:22
i fixed the z,y,z problem, but not surprisingly it didnt work?
heres my full code if y0ou want to see:
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 7th Mar 2009 22:33
i fixed it, because i accidentally setup the coolllision for the skybox instead of the terrain, but can anyone suggest any ideas on how to make it get the terrain height and not just collide with the box around the terrain object?
AlexZinn
15
Years of Service
User Offline
Joined: 17th Feb 2009
Location:
Posted: 9th Mar 2009 22:30 Edited at: 9th Mar 2009 22:31
to get the height check in one of sparkys collision samples

normaly this should work to find the Y(Height)



If someone need something, add me to your msn
Was SuperKid , now AlexZinn
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 10th Mar 2009 07:49
that doesnt work it still does the same thing
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 10th Mar 2009 10:45
this is the code that didnt work that i used:

dbPositionObject( 4, newx + normx / 10, dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ), dbCameraPositionZ ( ) );
, newz + normz / 10 );
silenus
15
Years of Service
User Offline
Joined: 4th Mar 2009
Location:
Posted: 10th Mar 2009 10:50
dbPosition takes 4 arguments seperated by comma, but after dbGetterrainGroundHeight (bla bla) you got a semicolon instead of a comma.
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 10th Mar 2009 11:10
i changed it and it still doesnt work
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 10th Mar 2009 14:16 Edited at: 10th Mar 2009 14:17
this is how ground height would be done in basic am sure you'll able to convert to GDK.



Dark Physics makes any hot drink go cold.
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 10th Mar 2009 23:31 Edited at: 10th Mar 2009 23:35
what is rem?
What does the Player.Control: thing do?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Mar 2009 23:44
REMARK COMMENT NOTES IGNORED BY COMPILER.... Sorry About the CaPs

--JAson

Login to post a reply

Server time is: 2024-11-25 17:54:53
Your offset time is: 2024-11-25 17:54:53