Problem with "set position" of UID instance of an object

  • Hey,

    im trying to set position to a collision object that i created with solid's behavior on a sprite of my layout, i don't know why but the object doesn't change of position and stay where i put on the layout at the beginning, screenshot below :

    [img=

    ]

    Thanks for help

  • The code?

    -> On start of the Layout

    Pick instance with UID : obj.UID

    Set position X, Y

    ?

    Or obj.setPoisition(X, Y)?

  • Sorry, it didnt uploaded the screenshot, here the code:

  • Damn, it should work (see your code in my project below)

    dropbox.com/s/gsapgqbjgylakz0/Collision.c3p

    Your UID is not the good one, perhaps you permute UID from moving to collider (or vice versa)?

    You have a Pin(ed) Bahavior?

  • I don't have pin behavior, i see it in a post but i don't know really what is the point of this behavior,

    here two screenshot with uid of selected obj, i think my UID is good right?

  • I think you cannot depend on UID to always be the same. So you should not use it like that.

    You can select a specific object by Instance variable that you have previously assigned in your code.

    eg on Platform created set instance variable "MyNum" = 7

    then later...

    Pick Platform with instance variable "MyNum" = 7

  • i just figured out why, i just forgot to include my event sheet in the main event sheet...Sorry i sucked :D

  • "I think you cannot depend on UID to always be the same. So you should not use it like that.

    You can select a specific object by Instance variable that you have previously assigned in your code.

    eg on Platform created set instance variable "MyNum" = 7

    then later...

    Pick Platform with instance variable "MyNum" = 7"

    You mean the UID can change? I thought the UID was the unic ID of each instance, it's not supposed to change.

  • I don't have pin behavior, i see it in a post but i don't know really what is the point of this behavior,

    Like…a pin : you stick a sprite to another, but you can't move it without unpin it at first

    here two screenshot with uid of selected obj, i think my UID is good right?

    Yep… weird.

    Check the X and Y of the moving platform before assigning them, they should not be as you think…?

  • i just figured out why, i just forgot to include my event sheet in the main event sheet...Sorry i sucked :D

    Oh, good one!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You mean the UID can change? I thought the UID was the unic ID of each instance, it's not supposed to change.

    UIDs wont change but they can be assigned by the engine during run-time in different ways,

    during runtime, you can retrieve and use the UID of an object

    but you should never assume that a UID will be a specific value.

  • > You mean the UID can change? I thought the UID was the unic ID of each instance, it's not supposed to change.

    UIDs wont change but they can be assigned by the engine during run-time in different ways,

    during runtime, you can retrieve and use the UID of an object

    but you should never assume that a UID will be a specific value.

    Thank you for the advice, il will remember that :)

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