Hi pinete.
this code work on android and windows.
SetDisplayAspect( 4.0/3.0 )
// Created Sprite
spr = CreateSprite (0)
SetSpritePosition (spr,50,50)
do
if ( GetPointerPressed ( ) = 1 )
if mousepressed = 0
mousepressed = 1
xc1= GetPointerX()
yc1 = GetPointerY()
xc = 0
yc = 0
hit = GetSpriteHit(ScreenToWorldX(xc1),ScreenToWorldy(yc1))
//if xc1 = GetPointerX() and yc1 = getpointery()
if hit >= 500
print ("You clicked over a building!")
popup = 1
endif
//endif
endif
endif
Print ("hit is :" + str(hit))
Sync()
loop
at first you should Create a Sprite that GetSprite Hit can work.
// Created Sprite
spr = CreateSprite (0)
SetSpritePosition (spr,50,50)
and no need check below line:
if xc1 = GetPointerX() and yc1 = getpointery()
.....
endif
also your sprite hit may great that 500 and you should check it like this:
if hit >= 500
print ("You clicked over a building!")
popup = 1
endif