Game Development Community

Console message: "0 has no namespace on collision" when cloning an object

by Kayrel Parcen Vandal · in Torque Game Builder · 05/29/2009 (6:40 am) · 2 replies

Dear all,

I have a ship who shots multiple missiles at a time, to do so I wrote this logic:

1 - Create a missile
2 - Clone it and change the velocityY so that the missiles are shot in differents angles

Like this:

for (%x = 10; %x< %missile.multiply; %x+=10) {

%clon = %missile.clone(true);
%clon.setLinearVelocityY(%x);

}

Graphically, it works perfect, it creates 5 missiles that collide as expected with the enemies and the like, but when i watch the console output it sends every time i shot these clones missiles these message:

Con::execute - 0 has no namespace: onCollision
Con::execute - 0 has no namespace: onRemoveFromScene
Con::execute - 0 has no namespace: onCollision
Con::execute - 0 has no namespace: onCollision
Con::execute - 0 has no namespace: onCollision

It is making the game slow, and I cant really understand why is some object being created with that namespace???


I would really apprecite any kind of help with this issue

Thanks a lot in advance,

Best regards,

#1
05/29/2009 (6:49 am)
Clone all your missiles when the level loads, set them inactive and store them in a simset. Then when you need to fire one, grab it from the simset, put it in the right place and make it active. Stick it back in the simset when it leaves the screen or explodes so you don't run out of missiles.

The clone will still spit garbage into the console at the start (I wish someone would fix that), but at least it won't slow your game down. By the way, it's not the console output that's slowing the game, it's creating new objects that does it.
#2
05/29/2009 (7:07 am)
Hello conor,


Thank a lot for your input. The problem is that the user can shoot several times before the missiles leave screen or explode, this way I should create a big pool of missiles to take from. Enemies also shoot this kind of multiple missiles.

I will wait for another reply, if none, I will try your solution.

Thanks again!
Best regards