Comparing Frames

0 favourites
From the Asset Store
three fully animated characters ideal for your RPG side scroller projects
  • Good day. I just want to compare my frames from sprite1 to the frames of sprite2 without having too much events everytime i compare the two. (How can i make a short version of long method but has the same function)

    Please take a look at my example capx

    (UPDATED CAPX)

    http://www.fileconvoy.com/dfl.php?id=gf ... 54ef614044

  • Good day. I just want to compare my frames from sprite1 to the frames of sprite2 without having too much events everytime i compare the two.

    Please take a look at my example capx

    http://www.fileconvoy.com/dfl.php?id=g8 ... 4f2b1bb17c

    Think you have to explain in more details what you are trying to achieve with this, if you want help finding alternatives. When looking at you Capx, it seems that different things should happen if for instant (Sprite_1.Animation_frame 1 = Sprite_2.Animation_frame 1) but also if (Sprite_1.Animation_frame 1 = Sprite_2.Animation_frame 2) and so forth.

    But regardless of whether you use | in your condition, if you want different things to happen based on which condition is true, you will need to figure out which frame each of these were at some point and therefore use a lot of conditions.

  • 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

  • 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

    I don't see how that would reduce the work a whole lot, but might have misunderstood what he is trying to do?

    But if loop1(10240) = loop2(9020) should do something different than loop1(11002) = loop2(4030) then you would still need to add this to the code somewhere, resulting in a lot of events.

  • 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.

    I dont know how can i do this in construct 2 but how can i do the "Or statement" in construct 2?

    Example:

    0 or 1 or 2 or 3 or 4 or 5............or 100

  • You could use a "is between" comparison.

  • I tried this | "Pipe" symbol, construct 2 accepts it but when i run it, the other frames doesn't work.

    Example:

    Event:

    sprite1frame = 0

    sprite2 frame = 0 | 1 | 2 | 3 | 4 | 5

    Action:

    System go to layout 2

    On this example, only the frame 0 of sprite1 and frame 1 of sprite2 will work. The other frames seems to not work

  • I tried this | "Pipe" symbol, construct 2 accepts it but when i run it, the other frames doesn't work.

    Example:

    Event:

    sprite1frame = 0

    sprite2 frame = 0 | 1 | 2 | 3 | 4 | 5

    Action:

    System go to layout 2

    On this example, only the frame 0 of sprite1 and frame 1 of sprite2 will work. The other frames seems to not work

    Its because you think the | works in a different way than it does.

    The | will return true or false depending on whether one of the Or conditions are correct.

    So it should look like this:

    If Sprite.frame = 0 | Sprite.frame = 1 | Sprite.frame = 2

    = 1

    Then it will return true and therefore condition is true as well. If Sprite.frame is not 0, 1 or 2 then it will return false.

    So its not a functionality where you can ask in the sense of whether Sprite.frame is 0,1,2.....100 and if that's that the case do something. Well you can but you have to write it as I did above and compare it to either 0,1 (False, True)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > I tried this | "Pipe" symbol, construct 2 accepts it but when i run it, the other frames doesn't work.

    >

    > Example:

    >

    > Event:

    > sprite1frame = 0

    > sprite2 frame = 0 | 1 | 2 | 3 | 4 | 5

    >

    > Action:

    > System go to layout 2

    >

    > On this example, only the frame 0 of sprite1 and frame 1 of sprite2 will work. The other frames seems to not work

    >

    Its because you think the | works in a different way than it does.

    The | will return true or false depending on whether one of the Or conditions are correct.

    So it should look like this:

    If Sprite.frame = 0 | Sprite.frame = 1 | Sprite.frame = 2

    = 1

    Then it will return true and therefore condition is true as well. If Sprite.frame is not 0, 1 or 2 then it will return false.

    So its not a functionality where you can ask in the sense of whether Sprite.frame is 0,1,2.....100 and if that's that the case do something. Well you can but you have to write it as I did above and compare it to either 0,1 (False, True)

    i think there is no other way but to compare it 1 by 1

  • 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 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

  • > 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?

  • >

    > > 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.

  • >

    > > 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

  • Still hoping for a solution........

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)