//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
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