(AGK version: 108.13)
Submitted: 2013-06-17 12:49:39
function BallCollision(ball)

    c=GetSpriteFirstContact(ball)
    do
        if c=0 then exit
        spr=GetSpriteContactSpriteID2() 

        if spr<>0
            cx#=GetSpriteContactWorldX()
            cy#=GetSpriteContactWorldy()

            //... Hit(spr)
        endif
        c=GetSpriteNextContact()
    loop

endfunction
(AGK version: 2.0.15)
Submitted: 2015-12-04 06:49:50
//agk 2.0.15d

//falling box with physics

SetVirtualResolution(100,100)
SetPhysicsScale(0.025)

SetPhysicsDebugOn()

spr=createsprite(0)
SetSpritePositionByOffset(spr,25,25)
SetSpritePhysicsOn(spr,2)
SetSpriteAngle(spr,25)

ground=createsprite(0)
setspritesize(ground,100,1)
SetSpritePosition(ground,0,99)
SetSpritePhysicsOn(ground,1)

do
	if GetPointerPressed() then exit
	
	print("List:")
	List(spr)
	List(ground)

	sync()
loop
end

function List(spr)
 
    c=GetSpriteFirstContact(spr)
    do
        if c=0 then exit
        spr2=GetSpriteContactSpriteID2() 
        if spr2<>0
			print(str(spr)+" hit "+str(spr2))
        endif
        c=GetSpriteNextContact()
    loop
 
endfunction
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.