A shoot function with DarkGDK

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 382
Reputation: tomtetlaw is an unknown quantity at this point 
Solved Threads: 4
tomtetlaw's Avatar
tomtetlaw tomtetlaw is offline Offline
Posting Whiz

A shoot function with DarkGDK

 
0
  #1
Jan 19th, 2009
I am making a shoot function with my game and my dad ( being the geinous programmer that he is ) suggested that i should generate an imaginary line from the gun to whatever it's aiming at and then, if the user clicks then put a bulet hole at what its aiming at.
I am using vc++
i have windows XP pro sp3
and i am using The DarkDGK engine and library

any help would be good
Last edited by tomtetlaw; Jan 19th, 2009 at 2:25 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 14
Reputation: d0pedup is an unknown quantity at this point 
Solved Threads: 0
d0pedup d0pedup is offline Offline
Newbie Poster

Re: A shoot function with DarkGDK

 
0
  #2
Jan 19th, 2009
Is it 2d/3d ???

If it is 2d then create a line factoring in the angle of the gun and other variables don't draw it on the screen, just keep track of the end point.

In the current frame if the user click on the FIRE button, before rendering the next frame load the texture of a bullet hole in the target area.

If its 3d, schedule another talk with dad.

This is me, just "shootin in the dark" :wink.

Hope i have helped.

Edit: You are using an engine, i gave you the logic i am sorry i have no experience in DARKDGK engine.

Edit2:I assumed that the bullet travels in a straight line, from the barrel to the destination and then you stop tracking the bullet.
Last edited by d0pedup; Jan 19th, 2009 at 6:55 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 382
Reputation: tomtetlaw is an unknown quantity at this point 
Solved Threads: 4
tomtetlaw's Avatar
tomtetlaw tomtetlaw is offline Offline
Posting Whiz

Re: A shoot function with DarkGDK

 
0
  #3
Jan 19th, 2009
its 3d and yes it is a str8 line
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 14
Reputation: d0pedup is an unknown quantity at this point 
Solved Threads: 0
d0pedup d0pedup is offline Offline
Newbie Poster

Re: A shoot function with DarkGDK

 
0
  #4
Jan 19th, 2009
if the barrel is held parallel to the ground then
target = (x,y,z+RANGE_OF_BULLET).
if FIRE BUTTTON IS PRESSED {
load bullet hole texture at target
}
else {
do nothing
}

render frame().

I am sorry, i cant help you with gun held at an angle. Refer some books like physics for game programmers (or the documentation of your game engine).
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC