According to the Help, a function can return a value.
I am trying to get the following test code to work, but to no avail.
Basically I want the function to return true or false if the objects have collided.
The Remmed out Imagescollide line works if it is unremmed....
Any ideas would be much appreciated!
Thanks
Andy
I am trying to get the following test code to work, but to no avail.
Basically I want the function to return true or false if the objects have collided.
The Remmed out Imagescollide line works if it is unremmed....
Graphics 800,600,0,2 SetBuffer BackBuffer() Global player = CreateImage(50,50) Global box = CreateImage(800,600) Cls ;Draw Box Rect 50,50,600,400,0 GrabImage box,0,0 Cls ;Draw player Oval 0,0,20,20,1 GrabImage player,0,0 ;Main Loop Repeat Cls DrawImage box,0,0 DrawImage player,MouseX(),MouseY() If collision=1 Then Text 280,240,"COLLISION!!!" ;If ImagesCollide(player,MouseX(),MouseY(),0,box,0,0,0) Then Text 280,240,"COLLISION!!!" Flip Until KeyDown(1) End Function collision() If ImagesCollide(player,MouseX(),MouseY(),0,box,0,0,0) Then Return True Else Return False End If End Function
Any ideas would be much appreciated!
Thanks
Andy