How do I refer to For loop value?

0 favourites
  • 4 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • Hey Guys, in a pickle here.

    I'm trying to make this smart, instead of having to deal with many condition lines, to use a For loop.

    See the image of before the For loop:

    And after:

    I have 2 parameters here:

    1. Position of the Sprite (2/3/4)
    2. How many Drops does the sprite has (0/1/2/3)

    So I'm running a For loop to see if he is at position 2,3 or 4 (I have an array with the correct X position per 2nd column cell).

    Then I'm checking to see if the sprite IS in position 2, 3 or 4.

    Then I'm running a For loop to see if he has 0, 1, 2, or 3 drops.

    Then I'm telling the sprite to play a specific animation according to the position.

    For example, For position 2, with 3 drops, the animation is called "02.3"

    So what I tried to do was "0" + "position" + "." + "number of drops"

    I think the reason it's not working is that I don't know the syntax to refer to parameters and stuff (i.e. & ?)

    Tagged:

  • How Do I edit a post?

    Here is the correct BEFORE image:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you don't specify a name, you use loopindex. If you do, then you reference by name loopindex("HasDropLoop").

    To build up your string, you need to convert the number to a string, so str(loopindex("HasDropLoop")) would get that particular segment for you.

  • worked like a charm, cheers mate!

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