Setvirtualresolution(640,480)
ResetTimer()
//Create test sprite shape
id=CreateSprite(0)
SetSpriteColor(id,255,255,0,255)
SetSpriteSize(id,Random(10,60),Random(10,60))
SetSpritePosition(id,200,200)
//When left mouse is clicked or screen touched, check to see if this is over the sprite
Repeat
if ( GetPointerPressed ( ) = 1 )
hit = GetSpriteHit ( GetPointerX ( ), GetPointerY ( ) )
endif
Print("ID of Sprite is "+Str(hit,0))
Sync()
Until Timer()>15
End
Hint: GetSpriteHit() beware of invisible sprites^^
Setvirtualresolution(640,480) ResetTimer() //Create test sprite shape id=CreateSprite(0) SetSpriteColor(id,255,255,0,255) SetSpriteSize(id,Random(10,60),Random(10,60)) SetSpritePosition(id,200,200) //When left mouse is clicked or screen touched, check to see if this is over the sprite Repeat if ( GetPointerPressed ( ) = 1 ) hit = GetSpriteHitTest (id, GetPointerX ( ), GetPointerY ( ) ) endif Print(hit) Sync() Until Timer()>15 End