# How do I calculate collide with multiple enemy

Get help using Construct 2

### » Thu Apr 16, 2015 7:23 am

hi,

My first game is almost complete but I am facing a problem .....

- is there any conditions or action that can be used to calculate that if my player, collides with any enemy (solid behaviour applied) on its way they player dies ?
- about power up if I have something like a power that my player takes up & it got speed up & also doesn't die on collide ( Can anyone tell me how to do this as i wasn't able to figure this two out ??

Thanks for all your help !!!

Mike
B
36
S
13
G
1
Posts: 99
Reputation: 3,051

### » Thu Apr 16, 2015 8:50 am

The basics should be something like this:

Player on collision with enemy - player die

player on collision with power up
- power up destroy
- player set speed to player.speed+10

It would be hard to give any more precise info, without knowing how you have your events set up at the moment and what behaviours you are using.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Thu Apr 16, 2015 10:10 am

I like the idea to speed up for player but is there a possibility to add this speed for few seconds like a condition or action for that .....

Also about the collision with enemy so if I have about 50 enemy in my scene so for that I have to specify all the enemy individually in event sheet with action collision to get the player die ??? isn't there any other possiblity like player collide with ( enemy1 + enemy2 +enemy3 + ..... +...... +...... etc ) = die in event sheet ? is this possible ..... ?
B
36
S
13
G
1
Posts: 99
Reputation: 3,051

### » Thu Apr 16, 2015 10:33 am

If you have the paid version of construct you could add all enemies to a family and check collision with that.

I don't know how different your enemies are, but you could also choose to attach the enemy to a sprite or vica versa and check the collision on that sprite instead of each diferent enemy.
Another way would be to have just one enemy-sprite and have all the different enemies be animations of that sprite, which would also mean the on collision-event would just need one object.

There are many different ways..

One way of many ways to make the boost temporary would be to give the player timer behaviour and on collision set the timer for a certain amount of time.
Than on timer you could set the speed back to the original speed..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Thu Apr 16, 2015 11:14 am

@LittleStain Thanks for quick reply .....

Will try out you sugesstion .....

About the enemies I think both of the solution won't work as they are seperate from each other in size & shape so this is not possible ..... next about the animation they are all different from each other in that so I have to figure out something else .....

If you have any other idea like to I have only one player & 50 enemies sprite so I have to write a single action for each of them ..... player on collide with each enemy = dies ???

I was just figuring our a easy way then to write 50 likes for each level .....

I hope you got my point .....

but still thanks for all you time !!!
B
36
S
13
G
1
Posts: 99
Reputation: 3,051

### » Thu Apr 16, 2015 12:23 pm

Using a family would be the best option, but for that you need the paid version of construct2.

Without families, putting the animations together in the same object would be the best option to reduce the amount of events.
That they are all different in size and shape shouldn't matter much.
While writing specific actions for a specific type of enemy you would only have to check which animation is playing or have an instance variable telling you which enemy it is..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Mon Apr 20, 2015 5:13 am

@LittleStain I have just one question as everything is working fine . But can you tell me what action or condition to be used for the power ups ......

As the powers ups are picked up & used & then destroyed but how to use that power up for a specified period of time like for 2 sec ..... & then the game returns to original state ??? So how to specify the time limit for a power to get used ???
B
36
S
13
G
1
Posts: 99
Reputation: 3,051

### » Mon Apr 20, 2015 8:09 am

Adding the timer behaviour to an object for that should work.

on pick up
> object - set timer "powerup" for 2 seconds

object - on timer powerup
- end powerup
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Mon Apr 20, 2015 2:59 pm

LittleStain wrote:The basics should be something like this:

Player on collision with enemy - player die

player on collision with power up
- power up destroy
- player set speed to player.speed+10

It would be hard to give any more precise info, without knowing how you have your events set up at the moment and what behaviours you are using.

Sorry to ask you again but I tried your power up event with 8direction behaviour & its not working ..... even i tried player.8direction.maxspeed+200 it doesn't work ??

Should I set player.8direction.maxspeed or player.8direction.speed ??

So could you tell me how to do that with 8direction ......

Also about the set timer isn't there event after using timer behaviour with player . As I am not getting set timer under player on event sheet ?

So could you just tell me as where to find the set timer option ?

Thanks for all your help ......

Regards
Mike
B
36
S
13
G
1
Posts: 99
Reputation: 3,051

### » Mon Apr 20, 2015 3:51 pm

It's not perfect, but something like this would do the trick:

PowerUpExample

Playing with the values you can tweak it..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775