Spawning a boss when all other enemies are dead

Game Engine, Players & Web Plug-in, Virtual Reality, support for other engines

Moderators: jesterKing, stiv

Post Reply
jdrewelow303
Posts: 0
Joined: Sun Feb 06, 2011 6:59 am

Spawning a boss when all other enemies are dead

Post by jdrewelow303 »

i want to make a boss spawn when all of the enemies on my map are dead. i set up a control that said when the property "hp" equals 0 then subtract 1 property "enemy". then i made an empty object that said when property "enemy" equals 0 then add object "boss". when i kill all of the enemies a boss doesn't spawn and i can't figure out why, could it be because i use the same enemy duplicated? and if it is, is there a way i could duplicate the same enemy but make them all share the same property "enemy"? for example if i had 15 enemies then could i make it so when i killed an enemy the total property would drop by 1.

SolarLune
Posts: 0
Joined: Sun Feb 06, 2011 8:58 pm

Post by SolarLune »

I'm assuming you're using logic bricks - if this is the case, you'll have to use a message actuator and sensor to accomplish this. This would consist of sending a message like 'defeated' every time you defeat an enemy to the boss spawning object. The boss spawning object would have a property ('enemy'), and when the message sensor gets the 'defeated' message, it will subtract one from the enemy property. When the enemy property is 0, create the boss and delete the boss spawner.

I would recommend learning Python, as when complexity rises (like this example), the capabilities of the scripting language also increase.
Check out my blog of game design and BGE tutorials at http://solarlune-gameup.blogspot.com/

Post Reply