How to get a count of all objects with a particular name. In this case, both the ship and invader carry a bullet. This example counts all the BulletObjects.
int bulletObjectCount = 0; orxSTRUCTURE *objectToCheck = orxStructure_GetFirst(orxSTRUCTURE_ID_OBJECT); while (objectToCheck != orxNULL){ const orxSTRING name = orxObject_GetName(orxOBJECT(objectToCheck)); if (orxString_Compare(name, "BulletObject") == 0){ bulletObjectCount++; } objectToCheck = orxStructure_GetNext(objectToCheck); } //bulletObjectCount contains the total amount of active BulletObject(s).
[ShipObject] Graphic = ShipGraphic Position = (150, 150, -0.1) ChildList = BulletObject [InvaderObject] Graphic = InvaderGraphic Position = (250, 150, -0.1) ChildList = BulletObject [BulletObject] Graphic = BulletGraphic Position = (0, 8, -0.1) [ShipGraphic] Texture = ship.png Pivot = center [InvaderGraphic] Texture = invader.png Pivot = center [BulletGraphic] Texture = spawner-bullet.png Pivot = center