Small issue...

Started by
14 comments, last by zedzeek 18 years, 9 months ago
Really? That sounds really good, do you have a code snippet that shows how you did that?

-IV

-IVHumble Student

Advertisement
Just keep it simple:

Bullet bullets[100];

This gives you 100 bullets. Just put a flag in the bullet class that says whether a bullet is active or not. To delete a bullet, set it's active flag to false. To add a bullet, find an inactive one, set it's active flag to true and pop in your data.

Mike C.
http://www.coolgroups.com/zoomer/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
That was my suggestion.

But probably explained a lot better :P
__________________________________Peter Lewis ([email=me_AT_pjblewis.com]E-mail[/email] | Portfolio)
I have been working on a 3D shooter and i had this problem. The way i solved it was within the CObject class which i set up for all the game objects i tested for a collision with other objects including a bullet.

it was something like:

if(_pbsphere->TestCollision(this->_pgame->GetBullet()->GetBounding Sphere()))
{
this->_pbullet->SetPosition(100, 0, 0);
//this moves the bullet of screen
}

and within the CBullet class whenever i pressed the shoot button i would move it back to the centre of the camera with its set direction and velocity. Quite easy really!

Spencer
Thanks guys, that sounds like a great solution to my problem. Thanks for the help.

-IV

-IVHumble Student

not exactly what asked about but in my game lazers etc are treated as particle systems + not as a special object sort,
all PSs instances are created at game startup
each PS has a uniqueID each spaceshipo has a uniqueID, its very easy to send messages between the two (and not worry if one doesnt exist anymore)

This topic is closed to new replies.

Advertisement