# Comparing Frames

Get help using Construct 2

### » Wed Nov 30, 2016 12:15 pm

nimos100 wrote:
jance0405 wrote:i think there is no other way but to compare it 1 by 1

Might not

Depends on what you are trying to achieve.

The only reason I can see you wanting to use the | expression, is if you wanted to compare both sprites, like this:

Sprite1.frame = 0 | Sprite1.frame = 1 = Sprite2.frame = 0 | Sprite2.frame = 1

But in most cases I would still think using simple conditions like "Is between" and basic "Sprite1.Frame = 0" would make it easier to work with. Personally I haven't used | a lot, as I haven't really run into something where it would be extremely useful, but maybe someday

I dont understand that "Is Between" can you make a capx for me
B
30
S
12
G
4
Posts: 67
Reputation: 4,250

### » Wed Nov 30, 2016 4:38 pm

jance0405 wrote:
andreyin wrote:Just use a for loop and name your loops

For "loop1" from 1 to 12000 -> for "loop2" from 1 to 12000 -> if sprite2.animationframe = loopindex("loop1") -> if sprite1.animationframe = loopindex("loop2") -> do this

Thank you but it doesnt work.

Why doesn't it work?
B
125
S
43
G
41
Posts: 853
Reputation: 28,268

### » Wed Nov 30, 2016 8:15 pm

jance0405 wrote:
nimos100 wrote:
jance0405 wrote:i think there is no other way but to compare it 1 by 1

Might not

Depends on what you are trying to achieve.

The only reason I can see you wanting to use the | expression, is if you wanted to compare both sprites, like this:

Sprite1.frame = 0 | Sprite1.frame = 1 = Sprite2.frame = 0 | Sprite2.frame = 1

But in most cases I would still think using simple conditions like "Is between" and basic "Sprite1.Frame = 0" would make it easier to work with. Personally I haven't used | a lot, as I haven't really run into something where it would be extremely useful, but maybe someday

I dont understand that "Is Between" can you make a capx for me

The "Is between" is a system check, its basically just a combination of two "compare variables". When you add it you have a lower bound and and upper bound and then you add which value you want to check, in your case it would be Animationframe number.

But its looks like this:

0 <= [Some value] <= 10

And then its checks if [Some value] is between or equal to 0 or 10. But you find it under System in the top, if I recall correct.
B
45
S
12
G
2
Posts: 1,194
Reputation: 6,997

### » Thu Dec 01, 2016 11:17 am

andreyin wrote:
jance0405 wrote:
andreyin wrote:Just use a for loop and name your loops

For "loop1" from 1 to 12000 -> for "loop2" from 1 to 12000 -> if sprite2.animationframe = loopindex("loop1") -> if sprite1.animationframe = loopindex("loop2") -> do this

Thank you but it doesnt work.

Why doesn't it work?

The only frames being compared is from sprite1 frame 0 and sprite2 frame 1
B
30
S
12
G
4
Posts: 67
Reputation: 4,250

### » Sun Dec 04, 2016 2:51 pm

Still hoping for a solution........
B
30
S
12
G
4
Posts: 67
Reputation: 4,250

### » Mon Dec 19, 2016 1:00 pm

I know someone can help me with this
B
30
S
12
G
4
Posts: 67
Reputation: 4,250

### » Mon Dec 19, 2016 1:16 pm

@jance0405 explain to me what your trying to do exactly and i will make a capX for you
GMO FOOD = DEATH
B
24
S
9
G
5
Posts: 567
Reputation: 6,418

### » Mon Dec 19, 2016 1:32 pm

RookieDev wrote:@jance0405 explain to me what your trying to do exactly and i will make a capX for you

I just i want to compare the animation frame of sprite1 to animation frame of sprite2 without having multiple line of events. Please check the attach capx on my thread. Ill explain the problem there

If you have other ideas without using animation frame but with similar function to what i want to achieve. Please do it
B
30
S
12
G
4
Posts: 67
Reputation: 4,250

### » Mon Dec 19, 2016 1:41 pm

go to system

then

then compare

GMO FOOD = DEATH
B
24
S
9
G
5
Posts: 567
Reputation: 6,418

### » Mon Dec 19, 2016 1:44 pm

if sprite1.animationframe = 1
If sprite2.animationframe= 2
>>>>>>Perform action
GMO FOOD = DEATH
B
24
S
9
G
5
Posts: 567
Reputation: 6,418

PreviousNext