| | |
A shoot function with DarkGDK
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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
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.
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
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).
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).
![]() |
Other Threads in the C++ Forum
- Previous Thread: Efficiency of code used to read and write a delimited file
- Next Thread: Help decoding line of typedef/struct combo
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





