Help! One enemy in different positions?

Just started using Construct 2? Post your questions here

Post » Sun Feb 21, 2016 6:14 pm

Say in one layout, i add multiple instances of the same enemy (i.e. one enemy and different IDs). I have pinned those with boxes for animation purposes.
The problem is that all of the instances of that enemy dies when i kill one of it. PLUS all of those behave in a similar way too (e.g all will turn left and right simultaneously depending upon the first instance of the sprite).

Any HELP PLEASE!~!!!!
B
4
Posts: 10
Reputation: 222

Post » Mon Feb 22, 2016 12:55 am

Hi,

it's hard to tell without knowing your capx

but I try it anyway:
lets say you want to subtract 1 life on touch then it is important not just say "on touch" (here it would affect all enemies). You have to take "on touched object"

with the walk left/right I have no idea what went wrong - so here a solution that works
in this example you have to give the enemy a bullet behaviour, an instance variable "WalkingLeft" to false (if they start to the right), and an object they can collide with
obj_Enemy > on collision with obj_Wall
subevent: obj_enemy | is WalkingLeft || obj_enemy | bullet speed = -100; obj_enemy || set WalkingLeft to true
subevent: obj_enemy | is NOT WalkingLeft || obj_enemy | bullet speed = 100; obj_enemy || set WalkingLeft to false

hope this helps

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon Feb 22, 2016 1:45 pm

i might not have explained it properly.

Let me try again. The problem i am facing is that:

I've added an enemy and made clone (copied it) in different locations of the layout (game stage). Now:
-: all of my similar enemies die at once when only one of them is dead.
-: All enemies behave depending upon the first one,

Here's an example capx link: goo.gl/on69zO
B
4
Posts: 10
Reputation: 222

Post » Mon Feb 22, 2016 2:55 pm

The boxes work great - they behave perfectly like you planned it.
The problem ist that you pinned all your enemies to the first box. And so, of course, the destroy behaviour is on this one first box.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest