Weird bug with an even weirder workaround

Discussion and feedback on Construct 2

Post » Thu Nov 27, 2014 8:13 pm

Sorry for not making bug reports but I don't currently have time to look deeply into this and have tried to recreate it but failed, and there is a workaround. I wanted to see if anyone else is running into a similar situation.

So in my scenario, I have a powerup that creates a shield that gets positioned onto the player.
In the event where the shield spawns, it sets it's instance variable "PlayerUID" to the player to stick it to, and in another separate event, it positions at the player as long as the "PlayerUID" matches the Player's UID.
This works fine, until a recent update (can't pinpoint when, but past 2 updates? :( ). Now the shield gets created but doesn't position at the player.
So you might be thinking "Maybe it's a ForEach problem?" or maybe it's my own code error somewhere else? Well... here's the best part. the shield will begin to stick onto the player the next time there is a "Wait 0" command. I can literally create a new event like "On K pressed" (knowing I do not use the key anywhere else in my events) and put "Wait 0" as an action, run the game, spawn the shield, see that it isn't sticking to me, hit K, and boom, the shield begins sticking to the player all the time like it should be.
Another Workaround is to put 2 "Wait 0" actions at the end of the "Create Shields" event, the shield spawns and sticks to player as it should.

[NOTE: I have not used "Wait for signal" at all in my project]

I can't replicate this in a separate capx but man I really thought this was my own error but the fix literally throws me off completely.

Hope this reaches someone in a similar situation if they are stuck. Wait 0 is your friend. :mrgreen:
Posts: 571
Reputation: 9,819

Post » Fri Nov 28, 2014 9:49 am

Do you destroy the shield at the beginning of the layout? Also maybe just use Pin behavior to pin the shield to the character?
My professional Royalty Free Music at Scirra Assets Store
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
Posts: 1,987
Reputation: 20,203

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 1 guest