Destroying an Ammo Box.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Destroying an Ammo Box.

Post by disanti »

How do I destroy my Ammo Box node?

I tried:
nplasmacells->drop();

and it crashed when I collected the box.

then I tried:

delete nplasmacells;

and that also crashed! :(

Code: Select all

		vector3df difference = ndroid->getPosition() - nplasmacells->getPosition();
		if(difference.getLength() < 30)
		{
			droid.setAmmo(droid.getAmmo()+300);
			delete nplasmacells;
		}
When I don't have it drop/delete, everything works fine but it doesn't disappear and keeps adding to the ammo :P
________
Mercedes-Benz W125
Last edited by disanti on Tue Feb 22, 2011 7:57 am, edited 1 time in total.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Ok, I got it to stop counting up by doing this:

Code: Select all

		if(nplasmacells != 0)
		{
			vector3df difference = ndroid->getPosition() - nplasmacells->getPosition();

			if(difference.getLength() < 30)
			{
				droid.setAmmo(droid.getAmmo()+300);
				nplasmacells = 0;
			}
		}
But the box still doesn't disappear :(

Thanks~ John DiSanti
________
Vaporizer wiki
Last edited by disanti on Tue Feb 22, 2011 7:57 am, edited 1 time in total.
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

setVisible(), maybe that'll work, havn't tried it yet though
The Robomaniac
Project Head / Lead Programmer
Centaur Force
madinitaly
Posts: 92
Joined: Sat Nov 29, 2003 8:30 pm
Contact:

Post by madinitaly »

Uhmmm, will

Code: Select all

nplasmacells->remove ();
do the trick?
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Thanks both of you!

I didn't originally know how to make things invisible and I didn't know of the remove command.

:)
________
Steroid Rehab Advice
Post Reply