How can i pick an object by UID, that has been created by a function?

0 favourites
  • 6 posts
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • Hi :)

    i created a slot machine using construct 2,

    everything is working perfect, except one problem:

    i can't pick the symbols that are on a winline, to let them blink.

    this is the function, that creates the slot symbol in the position, that it reads from php/json:

    how can i select this object (sprite) by UID in another function, so that i can activate the effect?

  • You could always give Symbol1 an instance variable and so when it's created in that particular event in the screenshot set the variable to something unique. Then in a different function you can use the variable to pick right instances.

  • i'm afraid that won't work, because there are 9 different symbols, and all of them can appear more than once, by random.

    i need a way to pick the symbols by their position.

    these are the slot symbol positions (3x3):

    147

    258

    369

    for example, if 258 would be the winning line,

    i need to pick the symbols that are placed there,

    no matter which of the 9 possible symbol sprites it is.

  • Well if you're picking by position then even more of a reason to use a variable because you can have 3 symbols on one line with the same variable and the variable relates to the win line. So in the screenshot you're creating a symbol at 88,230, if that's position 2 then give it variable=2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • finally i got it to work :)

    i used a global variable for each of the 9 possible symbol placements.

    when a symbol is created, i store the UID of the just created symbol in that variable,

    like in the screenshot in my first post.

    then the winline check function determines, which winning line should be activated, and starts the animation of the symbol, picked by unique id.

    so if the slot matrix looks like this:

    147

    258

    369

    the winline in the middle (258) would be adressed like this:

    ...

    thank you all for your help

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