(AGK version: 108.15)
Submitted: 2013-07-13 15:00:36
Setvirtualresolution(640,480)
ResetTimer()
//Create test sprite shape
id=_CreateSprite(200,200,255,255,0,255)
SetSpriteGroup(id,1)
id=_CreateSprite(200,300,0,0,255,255)
SetSpriteGroup(id,2)
//When left mouse is clicked or screen touched, check to see if this is over the sprite
Repeat
    if ( GetPointerPressed ( ) = 1 )
        hit = GetSpriteHitGroup (2, GetPointerX ( ), GetPointerY ( ) )
    endif
    Print("If in Group 2, the ID is "+Str(hit,0))
    Sync()
Until Timer()>20
End

Function _CreateSprite(x,y,r,g,b,a)
id=CreateSprite(0)
SetSpriteColor(id,r,g,b,a)
SetSpriteSize(id,Random(10,60),Random(10,60))
SetSpritePosition(id,x,y)
EndFunction id
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.