Timer Pin Glitch

Bugs will be moved here once resolved.

Post » Mon Jan 05, 2015 4:20 pm

Problem Description
____ When an "On timer " condition is met for 2 of the same objects and and each one spawns an object, then you try to pin these spawned objects to the spawner, only the first spawner is picked and pinned to, However, the correct spawner is picked for any other variables or expressions you wish to pass on to the spawned object. ____

Attach a Capx
____ https://dl.dropboxusercontent.com/u/530 ... litch.capx ____

Description of Capx
____ The Cap X shows how when two cannons fire a laser, the laser gets colored correctly and even gets the proper angle, but gets pinned to the wrong cannon ____

Steps to Reproduce Bug
  • Step 1 Click on the Button that says "Fire Laser"
  • Step 2 Observe the wacky pinning of the blue laser
  • Step 3 Repeat until you've had your fill....

Observed Result
____ Blue laser is pinned to green cannon ____

Expected Result
____ Blue laser should have been pinned to the picked blue cannon, as every other expression picks as expected ____

Affected Browsers
  • Chrome: Yes
  • FireFox: Yes
  • Internet Explorer: Yes
  • Node Webkit: Yes

Operating System and Service Pack
____ Windows 7 ultimate Service pack 1 ____

Construct 2 Version ID
____ R 190 (64 Bit Steam) ____
B
20
S
2
Posts: 70
Reputation: 1,466

Post » Mon Jan 05, 2015 4:59 pm

Here are some other event combinations that cause the same problem when pinning

https://dl.dropboxusercontent.com/u/530 ... xample.PNG

The image above shows how even when not triggered, the same result is present

https://dl.dropboxusercontent.com/u/530 ... sworks.PNG

In this one I tried deviating the time slightly and this will pin properly 50% of the time. However, if I deviate the two timers by 0.1 seconds it pins properly every time.

https://dl.dropboxusercontent.com/u/530 ... iggers.PNG

In the above example, I use a different Object trigger (the button) and a "For Each" condition which ultimately does cause the lasers to pin properly; a functional work-around.

Hope this helps!
B
20
S
2
Posts: 70
Reputation: 1,466

Post » Mon Jan 05, 2015 6:13 pm

Closing as not a bug - it's actually working correctly, given that the event runs with two instances picked, but your events assume there is only one object picked. Simply add a 'for each' after the condition and it works fine.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Tue Jan 06, 2015 1:00 am

If this is working correctly, why does it pick individual objects for variables but not when pinning? or why would two timers triggering at the same time but within 0.01 seconds of each other sometimes register as firing at the same time, but not always?

It just feels kind of broken since it works for certain cases but not in every case or even a minuscule delay causes random results.

I should also mention using a "for each" brings a host of new problems. If your objects have two different timings they will then always fire off at the same time because its running the event for each laser cannon.

The only work-around is to delay them by 0.1 so they run their triggers seperatly so then the timers can have different set times
B
20
S
2
Posts: 70
Reputation: 1,466

Post » Tue Jan 06, 2015 12:41 pm

The problem is the event runs with two instances of 'Sprite' picked. Then you spawn 'Sprite3' from 'Sprite', which creates two 'Sprite3' instances. Then the actions that follow apply to both 'Sprite3' instances. In particular 'Pin to Sprite' takes an object parameter, and the way the C2 engine works this does not pair up instances, it will just find one 'Sprite' and use that for both actions on 'Sprite3'. If you add a 'for each' condition it then properly runs the actions once per instance, spawning one object at a time and applying the actions for just that one spawned instance. As far as I can see this entirely fixes the problem in general, there should not be any other problems from doing that.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Tue Jan 06, 2015 7:10 pm

Okay I think I see where my thinking was wrong, I assumed that since the turrets were picked individually for their variables, they would be picked individually for the purpose of pinning. But as you have stated C2 will not pair up instances for object parameters in the same way it will with object variables. I will simply try to work around this inconvenience. which so far, has involved simply adding object.iid*0.1 to any attack timer since the "for each" condition will cause all lasers to fire even when they are intended to have different timings or can have the same exact time as is determined by the player.
B
20
S
2
Posts: 70
Reputation: 1,466


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest