Conditional Statement Not Registering

Student is trying to get text appear when her two sprites are touching. We cannot get ‘if’ to work but the ‘else’ is showing up. We tried debugging and setting a different shape collider, it still won’t show up. They displace each other as intended. Stumped!!

Hi jordan.priebe,
Sometimes the placement of “drawSprites();” is all you need to change --the text might be hidden behind the sprites.
If that doesn’t work, please post a link to the project so we can try it.
Have a great day!

Here is the link to my student’s project, thank you!

Timing is everything.

displace positions the sprites such that they are adjacent but do not overlap. Because you test for overlap before you move the sprites and since after moving the sprites you eliminate any overlap they will never be caught overlapping.

So,

  1. move the sprites causing an overlap.
  2. Test for overlap.
  3. call displace to remove the overlap.

I’m not quite sure what you mean by overlap. Would you mind clarifying what you’re suggesting a bit more for me? Thank you!

Actually, we figured it out. Thanks for your replies!

Glad you figured it out!
~Michelle