Destroy all enemies on screen

Non-platform specific questions.

Destroy all enemies on screen

Postby lverona » Tue Mar 05, 2013 1:14 pm

I want to have a weapon in the game which will destroy all enemies on screen at once.

For each enemy I have a DeathEnemyX() function, like DeathBase1(), DeathBase2(), etc., each of which places the explosions in the correct spots and such.

In order to achieve that I decided to create an actor which would be the size of the window, 640x480, not drawn but accepting events. I made sure that each enemy has a Collision event with that actor, in which I called the DeathEnemyX() function.

However, for some reason, when I press the button and the "bomb" goes off, only one enemy is destroyed. And I can destroy all of them by pressing the fire button several times.

What am I doing wrong here?
Is there a better way?
lverona
 
Posts: 221
Joined: Tue Apr 24, 2012 11:54 am
Score: 1 Give a positive score

Re: Destroy all enemies on screen

Postby moonforge » Tue Mar 05, 2013 3:19 pm

I have an idea, but it could be completely wrong. Here it goes:

You create a region actor that has the view be its parent. Then, you have it so that all enemies in the region have the ability to be destroyed when you shoot a bomb. If you need more help, leave a reply asking for more.
http://wannowandrichardsgames.weebly.com/

"You don't have to win to be a winner. You just have to pretend to be better than everyone else."

+ 1 please?
User avatar
moonforge
 
Posts: 45
Joined: Mon Jan 28, 2013 3:58 am
Location: CENSORED
Score: 8 Give a positive score

Re: Destroy all enemies on screen

Postby lverona » Tue Mar 05, 2013 3:35 pm

I did locate a bug in my approach - I had a Destroy Collide Actor in the function, so my "bomb" would get destroyed by the first enemy it touched upon. Fixing it right now.
lverona
 
Posts: 221
Joined: Tue Apr 24, 2012 11:54 am
Score: 1 Give a positive score

Re: Destroy all enemies on screen

Postby lverona » Wed Mar 06, 2013 6:15 am

Okay, so I managed to realize it the way I described above. I did have to redo my DeathEnemyX functions, but it works now and works very well. Yay!
lverona
 
Posts: 221
Joined: Tue Apr 24, 2012 11:54 am
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron