Skip to main content
gamedev.net
🔒 Locked

Bullets

Started by cpp boy 4 replies 500+ views
Original Post
cpp boy
cpp boy
Hey ! I''m currently making a game whit pour organisation. In the moment, the game looks great and has been using some code cleaning a lot to help me understand my own code. I''m currently making a bullet system but I''ve tried and every attempt are worse and worse. So I like to have an algorytme of how doing so. I''m using c++ to do so. Don''t need to be api specifique any kind of algorythme will go fine,
Kevin
gwihlidal
gwihlidal
Well you need to be a little more specific than that, is it a 3D api you are using like OpenGL or D3D?

If so, you need to use what are called decals to apply textures to 3D geometry. Nate Miller did a tutorial on flipcode about this for OpenGL. You will need an object (class or struct) and an array of them to simulate the bullets currently spawned, then you need to update their positions, etc.. each frame, and when a collision occurs, apply a decal at that collision face.

~Graham

----
while (your_engine >= my_engine)
my_engine++;
cpp boy
cpp boy
O scuse me. I''m using 2d graphics and I''m making a little space game. It''s nothing that great and no 3d. I already know how to load image.

Kevin
Kevin
Enokh
Enokh
Algorithm for what? What exactly isn''t working for you?
gwihlidal
gwihlidal
You need to look into object oriented programming a little more than, that isn''t an algorithm issue, that is a programming logic issue.

~Graham

----
while (your_engine >= my_engine)
my_engine++;
johnnyBravo
johnnyBravo
its so easy!

main thing is to use arrays, and something to handle the array when a bullet is destroyed..

vectors are good

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.