can i do this is one line ?

0 favourites
  • 10 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • hi can i do this is one line ?

  • First screenshot:

    You can combine all 4 conditions into "Or" block, it will be a bit bulky but it will be one event.

    Or you can change all four condition to this one:

    System -> Compare two values-> (bgg=7 | bgg=14 | bgg=21 | bgg=28) = 1

    Second screenshot:

    TakHarf On frame changed -> Set WallpaperCount to (TakHarf.AnimationFrame>7 ? (TakHarf.AnimationFrame-7) : TakHarf.AnimationFrame)

    (if there are no more than 14 frames in this animation)

  • on frame changed

    ->for loop "f" = 1(?) to AnimationFrameCount(Or how many frames you are using... its zero based, so no idea if you know that)

    --> animation frame = loopindex, set wallpapercount to loopindex

    AnimationFrameCount-1 if using the zero frame

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • newt

    What do you need the loop for? You can simply compare AnimationFrame expression.

    Also, for frames >7, the wallpaperCounter should start from 1 again.

  • Ok do two loops.

    Topic asks if he can do it one line.

    Answer is no, but less is doable.

  • First screenshot:

    You can combine all 4 conditions into "Or" block, it will be a bit bulky but it will be one event.

    Or you can change all four condition to this one:

    System -> Compare two values-> (bgg=7 | bgg=14 | bgg=21 | bgg=28) = 1

    Second screenshot:

    TakHarf On frame changed -> Set WallpaperCount to (TakHarf.AnimationFrame>7 ? (TakHarf.AnimationFrame-7) : TakHarf.AnimationFrame)

    (if there are no more than 14 frames in this animation)

    worked like a charm thank you

  • newt, You don't need any loops. And yes, this can be done in one line, see my first comment.

  • newt, You don't need any loops. And yes, this can be done in one line, see my first comment.

    Yeah I don't expect regular users to figure out undocumented features.

    Not that I expect them to understand me completely anyways.

  • Conditional operator is not an undocumented feature <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    https://www.scirra.com/manual/78/expressions

  • Well the "or" isn't. Someone just casually searching isn't going to get that its bool.

    Then the conditionals aren't explained very well. Like most of the manual an example case is needed.

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