How do stop condition from applying when it should't?

0 favourites
  • 6 posts
  • Hi (Relative Newbie here)

    I am trying to get a sprite to show when a condition is met. Specifically I get the value of a variable using system>get on overlap with mouse.x & mouse.y and then copy the individual sprite value to a global variable. Then I test to see if the global variable is a 1 or 2. If it is a 1 there are 2 possible sub-events. In one I pin the sprite and in the other I have a warning sprite become visible with an opacity change. For some reason the second sub-event is applying when the global variable is 2 also. I only want it to apply when global variable = 1. Here is my snippet of code.

    Thanks for any insight you might have.

    Kate

  • Sorry forgot to add project link.

    drive.google.com/file/d/1u72S-ybMeCEF73mBEwwp3a-oOmBVMN4A/view

  • I haven't looked closely at your example, but when Construct is firing off when it seems like it shouldn't I immediately wonder if a "System > Trigger once when true" event needs to be added to the conditions.

  • Hmm. . . I have tried adding it both when the global variable is tested for (=1) and in the subevent after the global variable is tested for. Neither seem to make a difference. The warning sprite still pops up when the variable = 2. . . . I will set up a test file and see if I can reproduce the results there (maybe another part of the code is affecting it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, I went and tried to reproduce it seperately from the larger program. I rewrote that bit using plain geometric shapes but it doesn't repeat the warning so I must have a bug in my code. Wish me happy hunting!

  • It's probably because on event 92 you say show the warning and the only condition is that it must be in a certain location. I would also suggest using object overlaps instead of all the x,y checks but if you know what all that means fair enough, someone looking at the project file has no real idea.

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