Issue with multiple X and Y areas for mouse hover behaviour

Zedek

  • Posts: 20
Hi everyone, first time posting here. I usually google for answers which often come back with posts here. Problem is I'm not sure exactly what to google here.

My issue is that I have a hover behaviour which checks the mouse is between say 100X and 150X and then 100Y and 150Y. In my first instance of this it worked fine with two variations of this, the hover would work and then I added a clicking behaviour. In my second instance I'm trying to check four areas, I simply can't get it to work properly. Not sure if it's something obvious or I'm missing something.

Thanks in advance for any help! Attached is the code I'm having issues with, I can upload more if you like.

« Last Edit: October 26, 2017, 03:35:43 am by Zedek »

letmethink

  • *
  • Posts: 2545
From what I can see, your issue is with the "otherwise if" areas. If you mouse x position is between x of self + 8 and x of self + 106 then it will not check any of the other areas. I guess an easy solution to this is to replace the "otherwise if" statements with "if" statements or to put the checks for y and the checks for x in the same if statement.
~Letmethink

Zedek

  • Posts: 20
Thank you so much! I didn't think about how the otherwise IF statements would take a backseat to the main IF statement. Which explains why the first code worked (it was for two areas side by side) so the X area would never cross in the arguments!

Thanks again because it's all working perfectly now.