How do I pick up good instance after a "compare two values"

Just started using Construct 2? Post your questions here

Post » Fri Mar 07, 2014 7:23 pm

Hi everyone :-)

Enjoying a lot this software ...

However something simple I don't get at all :

I want an ennemi of "Evil" type to wake up when Hero gets close. I use "compare two values" :
distance(Evil.X,Evil.Y,Hero.X,Hero.Y) < 600

Then :

Evil set awake to 1


Problem : When triggered, every "Evil" type have awake set to 1

Spent 2 hours on this, read a lot about it ... Still don't get it, any help will be greatly appreciated !!

Best,
Charles
You do not have the required permissions to view the files attached to this post.
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Fri Mar 07, 2014 7:31 pm

you 'd have to add a System>For each Evil condition for this to work (not sure it is the best way to do it, since it can make a lot of calculs if there is a lot of evil and hero))
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Fri Mar 07, 2014 7:44 pm

it actually did the trick yes, thanks a lot
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Fri Mar 07, 2014 7:44 pm

You can also just use "Pick nearest Enemy to Hero" and use it together with the distance check you already have.

The reason it picks everyone, is because you haven't told it which "Evil" you want to check the distance to hero. So it just take all of them or a random one, not sure.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Fri Mar 07, 2014 7:54 pm

Thanks that's good idea so it only check the nearest. Actually, I tried to replace it by

Evil : awake = 0

it seems to work as well
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Sat Mar 08, 2014 11:44 am

try instance variables learn about instance variables here
https://www.scirra.com/tutorials/806/instance-variable
B
257
S
42
G
15
Posts: 1,991
Reputation: 41,411

Post » Sat Mar 08, 2014 11:53 am

I use something similar in my level selection, you can probably add instance variables, lets say its called (Sleep) set all to -1 for "Evil" except the intended evil, set it to 1,


- Distance ( x ) < 600
-- System Evil.Sleep = 1 ----> Set Awake = 1 (Compare instance Variable for Evil)

I'm not properly skilled but that's how I work out my events. Hope this helps =o)
Image Stoorn Memory Puzzle
B
9
S
3
G
1
Posts: 66
Reputation: 1,488


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest