projectile programing
I am trying to make a very simple first person shooter, I have everything except the code for the bullet. I have a bullet that follows the player''s crosshair. Help would be greatly appreciated.
Could you elaborate a little? You say you have everything except the code for the bullet, yet you say you have a bullet that follows the players crosshair... what exactly is the problem? what do you mean it follows the crosshair?
Insomnia
Insomnia
Insomnia
Let me take a stab at this:
By following the crosshair, that's how you update your bullet. Its target is set to your crosshair.
What you need to do is create a little struct for your bullet, containing it's position (x,y,x) and its direction & velocity - you could also include graphic type & animation frame in here.
Then you create a list of these bullets, and each frame cycle through the list until you're done, updating the position in accordance to each bullet's direction and velocity.
Is that what you're after?
"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick
"It is far easier for a camel to pass through the eye of a needle if it first passes through a blender" -- Damocles
Edited by - morfe on February 23, 2001 3:59:26 PM
By following the crosshair, that's how you update your bullet. Its target is set to your crosshair.
What you need to do is create a little struct for your bullet, containing it's position (x,y,x) and its direction & velocity - you could also include graphic type & animation frame in here.
Then you create a list of these bullets, and each frame cycle through the list until you're done, updating the position in accordance to each bullet's direction and velocity.
Is that what you're after?
![](http://www.geocities.com/mind_phuq/mpsb1.gif)
"It is far easier for a camel to pass through the eye of a needle if it first passes through a blender" -- Damocles
Edited by - morfe on February 23, 2001 3:59:26 PM
"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick
I don''t see the point in showing a bullet animation or even having a model of a bullet, since you cannot see one fire past you in real life with the naked eye.
My advice is, like morfe said, create a struct, but have it contain the X,Y coordinates of your crosshair, and the Z will be definate (since it''s going foward). Then create an imaginary line from your player that keep going until it hits whatever its pointing at. If the line intersects with another player model, have it affect it with damage.
My advice is, like morfe said, create a struct, but have it contain the X,Y coordinates of your crosshair, and the Z will be definate (since it''s going foward). Then create an imaginary line from your player that keep going until it hits whatever its pointing at. If the line intersects with another player model, have it affect it with damage.
February 23, 2001 05:38 PM
well it might not be a bullet, it could be a rocket, some sort of magical blast or pretty much anything you can think of. Though for standard bullets, yeah just apply the damage directly.
Let me clarify, I have a bullet with (x,y,z) cords that moves foward and stays in the same space on the screen relative to the crosshair while everything else is translated around it. I am makeing the bullet visible so I can see where it goes, this may change later. For right now I am just trying to get one bullet to work, later I will add more.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement