Identify Objects with Pinned Object using UIDs didn't work

0 favourites
  • 10 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • i want to identify objects with pinned objects, i tried a lot of combinations and i cant find the solution, please help me! and explain me why this didn't works because i spend 3 days trying to solve this, i really want to understand.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Scratch that

  • Scratch that

    Sorry, i don't understand, what i need to scratch?

  • > Scratch that

    >

    Sorry, i don't understand, what i need to scratch?

    Sorry.. I gave a wrong solution so I edited my previous post..

    Was a bit too quick with my answer..

  • >

    > > Scratch that

    > >

    > Sorry, i don't understand, what i need to scratch?

    >

    Sorry.. I gave a wrong solution so I edited my previous post..

    Was a bit too quick with my answer..

    I cant see the solution

  • Majinboo

    I would do the UID instance variable the other way around:

    instead of storing the names,UID in the PinName object, I would store the PinName.UID in the names object.

    Then, anytime you pick a names object you can see if its PinNameUID variable is 0, then you know nothing is pinned to it. If there is a value in there, then you can pick the PinName object directly by that UID (rather than having go searching for PinName objects pointing back to the names object). That should simplify your code a lot.

    (unless, of course, you want to have more than one PinName object pinned to the names object at a time... but it doesn't look that way to me)

  • Majinboo

    I would do the UID instance variable the other way around:

    instead of storing the names,UID in the PinName object, I would store the PinName.UID in the names object.

    Then, anytime you pick a names object you can see if its PinNameUID variable is 0, then you know nothing is pinned to it. If there is a value in there, then you can pick the PinName object directly by that UID (rather than having go searching for PinName objects pointing back to the names object). That should simplify your code a lot.

    (unless, of course, you want to have more than one PinName object pinned to the names object at a time... but it doesn't look that way to me)

    thank you for your help, now i can identify objects with pinned object, but i am trying to identify "duplicated" objects with the same type of pinned object and didn't work by this way:

    or

    Even i tried to pick Names object with the same UID and didn't worked.

    CAPX:

    http://www.filedropper.com/identifypinn ... atedpins_1

  • This works only with individual objects and after destroying the pinned object i cant get the Boolean to false!, i want to set PinDuplicated "true" to all objects of the same type, for example if i have two pinned objects to two objects of the same type then all objects of the same type will have PinDuplicated "true", i dont why this is so hard to me, maybe i have low IQ? I was bad at math in high school .

  • Majinboo

    well, I am not sure I fully understand what you are trying to accomplish here, but I restructured your capx the way I think you want it to work... (it looked like you wanted to allow up to 2 of any name to be pinned, but after that no more of that name could be pinned).

    I didn't use the HavePin and PinDuplicated variables because I was able to do it without them, and they were just complicating things (you were only marking pinned ones as duplicated but that was not stopping additional ones of that name from getting pinned because if they were unpinned they were not being told that name was already duplicated).

    also, you were running the duplicate check on every tick - over and over again, even though most of the time nothing was changing. It is good practice to only check for things when something changes. So, now it only looks for duplicates before it tries to pin the current instance.

    http://www.rieperts.com/games/forum/PinnedObjects.capx

  • Majinboo

    well, I am not sure I fully understand what you are trying to accomplish here, but I restructured your capx the way I think you want it to work... (it looked like you wanted to allow up to 2 of any name to be pinned, but after that no more of that name could be pinned).

    I didn't use the HavePin and PinDuplicated variables because I was able to do it without them, and they were just complicating things (you were only marking pinned ones as duplicated but that was not stopping additional ones of that name from getting pinned because if they were unpinned they were not being told that name was already duplicated).

    also, you were running the duplicate check on every tick - over and over again, even though most of the time nothing was changing. It is good practice to only check for things when something changes. So, now it only looks for duplicates before it tries to pin the current instance.

    http://www.rieperts.com/games/forum/PinnedObjects.capx

    You are awesome!!!, thank you so much!!! i will study this amazing example to understand more about construct 2, i never thought that a global variable can store values of different objects.

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