SHOOTING GAME HELP

fizzle

31-05-2006 20:36:44

I am working on a shooting game and would like to limit 20 bullets to be shot and then want the new bullets shot to replace the existing ones, should i delete the body in the physics callback if its velocity is 0? or is there a better way, because as of now when there are 30 bullets at the same time the sytem slows down a lot. Also i saw the continous collision method and was wondering where i could find the states available to enter. Right now i pass in 0. The method i believe is setContinousCollision(unsigned int state);
Where could i find the possible enum for the variable state.

Thanks

danharibo

31-05-2006 20:57:50

use a vector :D

std::vector<Ogre::entity> entvec;

when you fire:

entvec.pushback(can't remember what goes here)

and

if( entvec.size() > 20)
{
entvec.popback(ithink)
}

walaber

01-06-2006 02:18:57

for setContinuousCollision, 0 = off, 1 = on.

fizzle

01-06-2006 02:40:22

thanks, i'll try the vector

fizzle

01-06-2006 02:42:30

actually, the problem is deleting the physics body and mesh afterwards, i'll see how the vector works but i think the physics body and ogre entity aswell as the scenenode may still be in the system and could slow down the game

persoontje

04-06-2006 16:47:00

actually, the problem is deleting the physics body and mesh afterwards, i'll see how the vector works but i think the physics body and ogre entity aswell as the scenenode may still be in the system and could slow down the game

You could put a pointer in the vector instead.

typedef std::vector<Ogre::Entity*> tEntityVector

tEntityVector* myvector;



(I've made here myvector a pointer, but thats not really nessecary, but I always do that)

Then in the delete code:

delete (*myvector)[number];
(*myvector)[number] = NULL;
myvector.popback(number)


I dont know if this is working code, but its just the idea. I should put the entity, scenenode, body and so on in a container class/struct, and put that in the vector.