Timer+Family+Pick Bug

0 favourites
  • 5 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Problem Description

    When two objects trigger a timer at same time, picking them by their UID always references the first instance.

    This makes it impossible to reference any instance variables the object inherits from the family (because it only references/picks the first instance).

    Attach a Capx

    https://1drv.ms/u/s!AhHSZHEulqh_gWhGfla3TMepNaln

    Description of Capx

    This sets a regular timer on two sprites, and picks via uid

    Steps to Reproduce Bug

    • look at events and run capx

    Observed Result

    both objects should move every second, but only the first instance does.

    Expected Result

    both should move every second.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    vista sp2

    Construct 2 Version ID

    r227

  • The manual states that you should use For Each after a timer event, if it is possible that more than one instance could be triggered at the same time.

  • Thanks! I guess this isn't a bug afterall.. Works with the for each.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The pick by uid: sprite.uid is just plane weird.

    Please, please, please don't use it like that.

    It's like talking to yourself in the third person.

    Also the for each on start is not needed.

    Anyway I don't think for each on the trigger is an answer either.

    Family2 is not associated with the timer, so when you broke picking with the pick by self.uid it defaulted to the first indice.

  • Conclusion: set timer behavior on the family, dont use 'for each'.

    edit: I understand what you try to do, and above suggestion is wrong. Deeply sorry.

    You have a bunch of differend sprites in the family, and you want only the instances of a certain sprite (member of the family) to move. I got that when i added more sprites to the family.

    At this moment, i dont know how to solve this, without a bunch of coding. Thinking.

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