Weird bug with an even weirder workaround

  • Hello!

    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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you destroy the shield at the beginning of the layout? Also maybe just use Pin behavior to pin the shield to the character?

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