How do I fix this bug (if it is a bug)?

0 favourites
  • 4 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • I'm using tilemap to create a long arrow that follows the mouse across the tiles it goes through. This doesn't matter though cause the problem isn't related to that. The problem is the event in the red box does not trigger even though the action in the green box does print "21" which is the tile im comparing to in the red box.

    What's also weird is that this only happens when I enable this "or" statement in the red box in the picture below:

    The red box statement is just comparing the tile where the mouse is to "21". When it's disabled the program runs fine. Why is this problem happening?

  • I wondered if it might be due to a collision (e.g. a triggered event) firing elsewhere. I'm not sure (and the docs don't say) if a triggered event only fires when the 'event processor' is at the outer level.

    How about creating a local variable and putting the Tile() = 21 test in that, calculated at the top of your tile checking, replace the green and red bits with testing that instead ? See if that works, if it does, see if the value of that test is somehow changing between the initial test and the end.

    It also looks to me that you are testing Tile(x,y) = something or other and as a consequence of that changing x and y. This is quite chancy for knock on effects. I'd be inclined to read Tile(x,y) into a local and then test it. What you basically have is a case/switch statement on Tile(x,y) and it is not a good idea to change the case/switch expression as you go

  • Thanks for the reply. Can you explain the first paragraph more?

    I have fixed the problem by separating the two "or" statements and not allowing the second statement to fire if the first one did. What do you think is going on? I will revert it and try what you said though by putting the "Tile() = 21" test at the top. I just gotta go to sleep now.

    You're right about the testing while x,y are changing though. I tried to circumvent that with the "tuned" variable, but your way is the better more obvious way to do it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In C2 (I think !) events run sequentially, but triggers - collisions, keystrokes etc. fire on as needed basis. I don't know where these fire in the 'event processing' though - if they could fire in mid event then this might be whats causing your problem.

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