Search code examples
numbersrangelivecode

How do you use a range of numbers in an if statement in livecode?


How do you do a range of numbers in livecode? I tried using "-" like this

if the loc of the image "yellowdisck.png" is 0 50,0-640 then

But this doesn't work.


Solution

  • It looks like you're trying to determine whether an object's location (its center point) falls within a rectangular area. Try using the is within operator:

    if the loc of image "yellowdisk.png" is within the rect of graphic "targetRect" then
       # do true stuff
    else
       # do false stuff
    end if