How do I get the coordinates of a value in an array?

  • This is more a question of syntax than of anything else.

    Basically, all I'm trying to do is pull a value out of a set x-y position on a 2D array and set a variable to it (situation being that I have an array to store values of stuff in a shop for something and I want to get the price based off the current selection in order to show if you have enough money to buy it). How exactly would I tell it which slot in the array I want to access? (I know in C it's arrayname[x coordinate][y coordinate] or something along those lines- how would I do that in Construct 2?)

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can access specific Array slots using "Array.At(x,y,z)" and set specific Array slots using Array->Set at X,Y,Z or whatever.

  • You can access specific Array slots using "Array.At(x,y,z)" and set specific Array slots using Array->Set at X,Y,Z or whatever.

    Thanks! It's working now

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