Timer+Family+Pick Bug

Bugs will be moved here once resolved.

Post » Sat Jul 30, 2016 8:54 pm

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
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Sat Jul 30, 2016 9:11 pm

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.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,188

Post » Sat Jul 30, 2016 9:15 pm

Thanks! I guess this isn't a bug afterall.. Works with the for each.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Sat Jul 30, 2016 9:41 pm

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.
Image ImageImage
B
168
S
50
G
163
Posts: 8,226
Reputation: 105,071

Post » Sat Jul 30, 2016 10:41 pm

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.
B
33
S
18
G
28
Posts: 2,455
Reputation: 20,874


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests