(AGK version: 108.14)
Submitted: 2013-07-12 01:47:23
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
(AGK version: 108.15)
Submitted: 2013-07-12 01:50:58
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
(AGK version: 108.19)
Submitted: 2013-10-28 21:12:20
Hint: GetSpriteHit() beware of invisible sprites^^
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.