[ Resolved ]How do I [ ARRAY ] Get Y value of X

  • Hello,

    I use the Inventory Systemmade by EncryptedCow.

    Then i would like to know if someone know how to :

    • Set one text to the value Y of X ( Something like Get the value stored on Y axis of a specific X like x = 1 or 2 or 3 etc ... )

    Then after

    • When i do one action Substract1,2,3,4 etc ... point from the Y value of the specific X ( Approximatly same thing as up, but instead of Set the text to, substract a certain amount from the Y value )

    Hope someone can help me =) Thank you =D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No one know how to do it ? ^^

  • You use At(X,Y) to get a specific value. Array.At(3,0) is referencing X=3, Y=0. To subtract the value at that index:

    Array.Set at XY, where X=3, Y=0, Value = Array.At(3,0)-1

  • Or after selecting the correct x thorugh events you could use:

    Array.At(Array.Curx,5)

  • Thank you blackhornet, the problem was with this Inventory the object don't spawn at specific slots, they spawn randomly.

    So the object can be one moment at X=1 and another moment at X=9 =s ...

    Then is there a way for specify it =s ...

    Exemple :

    The Object Sword have the ID_3 and is on the Slot 4 ( X=3 ) one time after it was at Slot 1 ( X=0 ) so how can i get at evry time is position ( X=... ) for apply the At(X,Y) =s ...

    Thank you =)

  • Something like

    array for each x

    system compare two values array.curvalue=3

    • set text to array.at(array.curx,5)

    ofcourse 3 should be a unique value in this case..

  • Thanks for all the help given =)

    Stain this is the good solution =), i have modify a little bit ( just add a function for set text to 0 if X don't check the value =D

    Big thanks to you two =) ( Not U2 ... Stain and BlackHornet XD )

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