Question of BGE

Hi all.

i am still making my game. and got one problem.
Basically i did so on my game:
Collision of Bullet (sensor1)-> python on yellow cube + python(same) on red cube (they both are from the SAME sensor1 - joined like in the example)

and in example is the same thing what i need to have.

but now i am using Randoms, so simple way doesnt work - both pythons have differend randoms. i need information how to do like that:

if my yellow Cube health is Value, than my Red cube health is the same(value).

it cant be like in python YellowCube[‘health’] = own[‘health’], i need health of the current which is added, becouse i have Spawn from layer2 to layer1, and the spawn adds 5 SAME Cubes with same names. and if i write in python: YellowCube[‘health’] = own[‘health’], it has the health count of the one YellowCube which is in layer 2. so i need the count of real-time Cube which is added in layer1.

In example i did like i wish to have (ti doesnt work afcourse, the program dont understand the “value” string.


example.blend (131 KB)

Please describe the problem in coherent English.

You may need to provide a FULL .blend file… the one that you’ve provided doesn’t really help to explain your problem.

When you add objects, you can get the object that are added by using addObjectActuator.objectLastCreated .That’s really the only way to access added objects. However, you also could parent the red cube to the yellow cube, and then using either object.parent or object.children[0].