Why do some of my conditions not always work?

I have these actions (or similar) for multiple items in my game:

Most of the time it works perfectly and the text box (detergent info) shows up, but sometimes it doesn’t! Does anyone have any idea why?


Try adding “Trigger once to the condition” and also check the collisions of your sprites. Also check if any other condition is conflicting with this condition. PS: Can you also share what always works and also what doesn’t work sometimes the time?

1 Like

I don’t think your condition will work when there are multiple simultaneous collisions.
To fix that you will need to add a “For each detergent” as a sub event of your condition, and move all the actions into that for each condition block.

1 Like

Thanks both, I’ll have a go and let you know.

A bit more info: there’s only one of each item in the game to collect and when the player collides with it a text box should come up explaining what it is. This changes the scene variable until the space bar is pressed and then the text box should disappear again.

Hope that answers any questions!

1 Like

There’s only one of each item so each text box is triggered once, I’ve noticed that it most often goes wrong when the player is jumping (the text box doesn’t appear).

I don’t understand why as all of the other actions happen apart from the two highlighted, so it is obvious that it recognises the collision. Any ideas?

I can only assume, since you only show this part of the code.
You change the variable pause game again somewhere else.
The textbox has another opacity tween playing.

So the block you show most likely works, but you have other conflicting events.

I’ll have a look, thanks Slash. The only other times that variable is referred to is when different items are collected but they are all far away from eachother so shouldn’t have an effect.

The variable is changed back to 0 (normal game play) when the space bar is pressed so I was wondering if it’s because the space bar is used to make the character jump it just hides it again instantly?

that explains your jump problem, yes.
you need to structure your events well, that they cannot conflict

1 Like

Great, thanks for your help Slash :smile: