AddText "Use arrows to move around"
'first generate two random sized boxes
box1width=Rand(20,100)
box1height=Rand(20,100)
box2width=Rand(20,100)
box2height=Rand(20,100)
Repeat
'update controls
If LeftKey()Then x=x-1
If RightKey()Then x=x+1
If UpKey()Then y=y-1
If DownKey()Then y=y+1
'box 1 (movable)
Box x,y,box1width,box1height,OFF
'box 2 (static)
Box 260,180,box2width,box2height,OFF
Text 20,20,"Overlapping: "+BoxOverlap(x,y,box1width,box1height,260,180,box2width,box2height)
DrawScreen
Until EscapeKey()
|
|