weird layer problem ...

hey …

so i have a game project in which the enemy bots are at layer 3 of the scene … there is an empty which adds the enemy bot to the first layer where the gme actually runs …

the enemy has integer property health … in the logic panel, it has been set to respond to a touch sensor which detects the material of a projectile hitting it … on sensing the touch, value of health is decreased …

weird thing is, the value of health doesnt change if the enemy bot is spawned to layer one in the game from layer three, BUT, when the enemy mesh is placed in layer one, without spawning, the health system works perfectly fine … why is this happening ???.. :eek:

sorrreee!!

the value of health does change … its just that i had debugged the value of the object in layer three and not of the object being spawned … hence, the debug output showed no change in health’s value… i added some event handlers when the bot life ran out, they executed nicely … :stuck_out_tongue:

That is because the debug information are the date of the inactive object on the hidden layer. That will never change as it is inactive.
The spawned objects are instances (copies) of this object, but the BGE does not show its properties in debug. The best way to debug this objects is to print to console.