Arrays help?

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi

    I would like to change the sprite of my tiles if the current layout name is present inside an array.

    Honestly I find somehow hard to understand the guides as I am not really into math or programming, but at first glance Construct makes it easy, although at the end the solution do not work...

    First i populated the array with the records, then, when the sprite is created I check if the layout name is included in the array, if it is positive, I change animation.

    I doesn't work at all, what am I missing?

    Thank you in advance.


  • That seems fine if you are creating the sprite later. Probably check the following basics :

    Are you definitely in a Layout called Layout 2 or Layout 3?

    Does the sprite animation "red" look how you expect?

    Is there any other logic that would change the Sprite animation back to something else?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Plinkie, thank you for providing help.

    As you can see, there is not misunderstanding about the layout name or the Arrays data, the file contains just that as I am actually trying to figure out as it work before integrating it in my project.

    There are not conditions that could bring the sprite back to default, and sprite Red has never shown up.

    Looked pretty easy but it is not apparently...

  • It has to do with the space within the layout name i guess.

    Used the underscore to connect the two words, and it works, here the micro code:


  • Not sure how the underscore worked, looks like the issue is that the values you pushed to the array have a lower case L, the name must be exact. If it's working though, problem solved :)

  • Checked the lower case thing, honestly wasn't fixing the issue, what actually helped was changing the layout name into a simple single word, then I tried the underscore fix and it worked.

    Arrays are a great tool but haven t found yet a guide that explains in a simple, yet visual way all the different functions and opportunities they give.

    Was the original Tetris made with arrays mainly?

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