Get help using Construct 2

### » Sat Dec 17, 2011 8:30 pm

Not that but thanks anyway! It has nothing to do about the mirroring. It's the "begin following player when get near enough" . I think i didn't express myself correctly. I've used the wrong example at start sorry ! I can't express the logic i want just using object compare X since i'm using the vertical distance between player and enemy calculated simply with abs(player.x - enemy.x). There's no way to pick it correctly with expressions yes ? So i'll have to separate it and detect when approaching from the left and from the right ? Duplicating code ? Or is there a better way ?Kiyoshi2011-12-17 20:54:14
B
58
S
15
G
11
Posts: 632
Reputation: 13,450

### » Sat Dec 17, 2011 8:56 pm

well
[code]System: abs(player.x-enemy.x) < distance
-> do things[/code]
is exactly the same as
[code]enemy: X > player.x-distance
enemy: X < player.x+distance
-> do things[/code]
And I think the picking would work

But if you really insist on using the system comparison, just put a foreach on top
[code]foreach enemy
System: abs(player.x-enemy.x) < distance
-> do things[/code]Yann2011-12-17 20:57:49
B
71
S
22
G
14
Posts: 1,494
Reputation: 16,660

### » Sat Dec 17, 2011 9:15 pm

Damn i had a signal wrong that it. Thanks for the patience :)
B
58
S
15
G
11
Posts: 632
Reputation: 13,450

### » Sat Dec 17, 2011 10:24 pm

Damn this is getting boring. It turns out the above solution only is not sufficient for my case. I remember Classic had Pick by Comparison. How it works exactly ?Kiyoshi2011-12-17 22:25:52
B
58
S
15
G
11
Posts: 632
Reputation: 13,450

### » Sat Dec 17, 2011 10:49 pm

Did a research and found out the the behavior i want is exactly like Cooper Enemy on Plaform School by deadeye. I'll just steal it all damn :) Though it uses Pick By Comparison as it facilitates things greatly. Anyway thanks all for the help.Kiyoshi2011-12-17 22:49:40
B
58
S
15
G
11
Posts: 632
Reputation: 13,450

### » Sun Dec 18, 2011 4:07 pm

Ashley, is Pick by Comparison to far ahead ? Would greatly facilitate things for my game. If it wont be coming anytime soon any idea of how do i simulate it ?
B
58
S
15
G
11
Posts: 632
Reputation: 13,450

### » Sun Dec 18, 2011 8:59 pm

A little bit of info:
[code]System: abs(player.x-enemy.x) < distance[/code]
That only compares the first picked "player" and "enemy" objects' values.

[code]foreach enemy
System: abs(player.x-enemy.x) < distance[/code]
This compares each enemy against the first picked instance of the player.

[code]enemy: abs(player.x-enemy.x) < distance[/code]
Now the "pick by comparison" that CC has is like the "system compare" with these differences:
1. Corresponding picked instances are used for expression values.
ex:
The first picked enemy is compared with the first picked player,
the second with the second,
the third with the third... and so forth.

If the amount of picked objects differ in count for example: 2 players and 4 enemies it will loop back to the first.
ex:
The first picked enemy is compared with the first picked player,
the second with the second,
the third with the first,
and the fourth with the second.

2. The enemy objects are picked.

I'd also like to point out these apply to picking in general with most object conditions.

Now for the workarounds until "pick by comparison" is added.
Since I assume there will be one player and many enemies Yann's second solution will work fine. I've also used private variables to do the same thing:

Every Tick-> enemy: set dist to abs(player.x-enemy.x)
enemy: dist < distance -> do stuff
B
100
S
38
G
134
Posts: 5,555
Reputation: 85,323

### » Sun Dec 18, 2011 9:09 pm

Yeah creating a dist variable should be more adequate to my events.To use Yann's solution i'd have to use an 'OR' for my particular case. I'll go this way for now. Yet Pick by Comparison would be very welcome. I hope C2 will be on par with Classic at least on non graphical things soon. Thanks R0J0hound.Kiyoshi2011-12-18 21:11:00
B
58
S
15
G
11
Posts: 632
Reputation: 13,450

### » Sun Dec 18, 2011 10:20 pm

Well found the origin of my problems:

-Enemy.isSomething -> Jump
-Trigger Once

What was happening : When one enemy triggered the if once, it wouldn't trigger again for any other enemy. I had trigger once on animations too. When i removed them all it all worked perfectly. Very strange. Kiyoshi2011-12-18 22:20:39
B
58
S
15
G
11
Posts: 632
Reputation: 13,450

Previous