How do I differentiate attacking between enemy instances?

Get help using Construct 2

Post » Mon Apr 28, 2014 11:36 pm

So i'm making a hitbox for the skeleton, making it a container and then creating multiple instances of it which should each react independently? Excuse me if i am slow on the uptake, my brain is frazzeled
B
4
S
1
Posts: 26
Reputation: 402

Post » Tue Apr 29, 2014 7:48 am

I suggest that you take a step back, learn and understand fundamentally how picking and events work and how containers and/or families will help. Then try to rework your game logic using that knowledge. There's little point in throwing a bunch of new ideas at wonky code unless you understand those ideas.
B
57
S
15
G
11
Posts: 912
Reputation: 12,606

Post » Tue Apr 29, 2014 8:24 am

use System: For Each (object name) on your events.

and you could identify which enemy is partnered with which enemy box (or vice versa) by using this method:

pin the enemy to the enemybox, then you can use the condition "Pick by evaluation"

For example:

+EnemyBox: Life > 0
+For Each EnemyBox

-> your actions
-(Sub event) Pick Enemy where EnemyBoxUID = Enemy.pin.pinnedUID
-> your actions

Pick Enemy where EnemyBoxUID = Enemy.pin.pinnedUID
means that you pick the enemy object that is pinned to the specific instance of the enemybox object

you can use it the other way
Pick EnemyBox where EnemyBoxUID = Enemy.pin.pinnedUID
means that you pick the enemybox object that you pinned the specific instance of the enemy object to

Read more about both concepts first on the manual to understand it better before attempting to use it.

as for reacting independently, you have to use random to randomize the AI. of course use "For Each" in the events.

reply with my name if you need a capx sample.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Apr 29, 2014 9:45 am

Try to add "for each skeleton" as an upper condition. Then put every other condition under it. I am not sure which event needs it but I'm almost sure this is the case.
Hope it helps.
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

Post » Tue Apr 29, 2014 2:24 pm

Thank you GeometriX, I took your advice and ran back through how events work and thanks to that i managed to muddle my way through this problem! Thank you all for sparing the time to help me with my problem :D
B
4
S
1
Posts: 26
Reputation: 402

Previous

Return to How do I....?

Who is online

Users browsing this forum: gskunk, newt and 47 guests