Arrays VS Dictionary

0 favourites
  • 6 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • The main thing I want to know the difference between arrays and dictionaries and that's because I have detected a problem in arrays:

    First Test: Condition: When Object dragdrop drag start ==> Action: Set Array.at (0,0) to Object.X and Array.at (1,0) to Object.Y

    Condition: When Object dragdrop on drop ==> Sub-Condition: (Invert) Object overlapping object2 ==> Action: Set Object position: X= Array.at (0,0) Y= Array.at (1,0). Action: Array: Clear.

    Conclusion: When I tested the game, On drag start the Array Save the position, on drop instead of putting the object on it's saved position, it took it to X= 0 and Y=0 . I don't know why.

    Second Test: Condition: When Object dragdrop drag start ==> Action: Add key "PX" with value Object.X Action: Add key "PY" with value Object.Y

    Condition: When Object dragdrop on drop ==> Sub-Condition: (Invert) Object overlapping object2 ==> Action: Set Object position: X= Dictionary.Get("PX") Y= Dictionary.Get("PY") Action: Dictionary: Clear

    Conclusion: The same test, but this time, the dictionary plugin in has saved the right positions and when dropped it returned them on the right position .

    the main question: Is the error from me or the C2 and Why that happened?

  • The main thing I want to know the difference between arrays and dictionaries and that's because I have detected a problem in arrays:

    First Test: Condition: When Object dragdrop drag start ==> Action: Set Array.at (0,0) to Object.X and Array.at (1,0) to Object.Y

    Condition: When Object dragdrop on drop ==> Sub-Condition: (Invert) Object overlapping object2 ==> Action: Set Object position: X= Array.at (0,0) Y= Array.at (1,0). Action: Array: Clear.

    Conclusion: When I tested the game, On drag start the Array Save the position, on drop instead of putting the object on it's saved position, it took it to X= 0 and Y=0 . I don't know why.

    Second Test: Condition: When Object dragdrop drag start ==> Action: Add key "PX" with value Object.X Action: Add key "PY" with value Object.Y

    Condition: When Object dragdrop on drop ==> Sub-Condition: (Invert) Object overlapping object2 ==> Action: Set Object position: X= Dictionary.Get("PX") Y= Dictionary.Get("PY") Action: Dictionary: Clear

    Conclusion: The same test, but this time, the dictionary plugin in has saved the right positions and when dropped it returned them on the right position .

    the main question: Is the error from me or the C2 and Why that happened?

    What was the size of your array? (if one of the dimension is 0, then the array won't work)

  • Is this true? I can't test this yet, but I recall a beginner's tutorial stating the array starting at 0,0.

  • Is this true? I can't test this yet, but I recall a beginner's tutorial stating the array starting at 0,0.

    I am talking about the size of the array, not the coordinate

    If the array is 10,1,1, then it'll go from 0 to 9, 0, 0

    (and since he doesn't use the z axis, he might have set it's size to 0, which will not work at the end)

  • Aurora Australis

    It starts at 0,0 but the size of the array is 1 width and 1 height. Just like how a 10-width array goes from 0 to 9, a 1-width array only has the 0 position in it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My bad, I misread Aphrodite's reply to OP.

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