As already stated, the IDE doesn't support concatenated lines. However, in your case you can still do it because your concatenation is with the
AND keyword. So you can simply create another
IF on the line below which will only be executed if the
IF above it is
TRUE.
Like this:
if GetRawMouseX() > GetSpriteX(Core.MainBarButtonSprites[i])
if GetRawMouseX() < GetSpriteX(Core.MainBarButtonSprites[i]) + GetSpriteWidth(Core.MainBarButtonSprites[i])
if GetRawMouseY() > GetSpriteY(Core.MainBarButtonSprites[i])
if GetRawMouseY() < GetSpriteY(Core.MainBarButtonSprites[i]) + GetSpriteHeight(Core.MainBarButtonSprites[i])
//Do stuff
endif
endif
endif
endif
You can make that easier to read by pre-creating simplified variable names, like this:
mx# = GetRawMouseX()
my# = GetRawMouseY()
sprX# = GetSpriteX(Core.MainBarButtonSprites[i])
sprY# = GetSpriteY(Core.MainBarButtonSprites[i])
sprW# = GetSpriteWidth(Core.MainBarButtonSprites[i])
sprH# = GetSpriteHeight(Core.MainBarButtonSprites[i])
if mx# > sprX#
if mx# < sprx# + sprW#
if my# > sprY#
if my# < sprY# + sprH#
//Do stuff
endif
endif
endif
endif
Both of those are good suggestions but in your case I wouldn't recommend either one. Your code is simply checking to see if a point is within a box. So you really should functionise that. Like this:
mx# = GetRawMouseX()
my# = GetRawMouseY()
sprX# = GetSpriteX(Core.MainBarButtonSprites[i])
sprY# = GetSpriteY(Core.MainBarButtonSprites[i])
sprW# = GetSpriteWidth(Core.MainBarButtonSprites[i])
sprH# = GetSpriteHeight(Core.MainBarButtonSprites[i])
if PointInBox(mx#, my#, sprX#, sprY#, sprW#, sprH#)
//do stuff
endif
function PointInBox(px#, py#, x#, y#, w#, h#)
if px# < x# then exitfunction 0
if px# > x#+w# then exitfunction 0
if py# < y# then exitfunction 0
if py# > y#+h# then exitfunction 0
exitfunction 1
I simplified the variable names again in the final example above, but that is just for clarity, you don't actually need to do that.
Finally, you can simplify it much further. If you don't have any overlapping sprites or you only ever want to test against the one on top (depth nearest the screen) then you can do this:
if GetSpriteHitTest(Core.MainBarButtonSprites[i], GetRawMouseX(), GetRawMouseY())
//Do stuff
endif