the annoying game
Posted: Sun Apr 11, 2010 5:43 am
Hi, this is something I threw together in a few minutes. I wanted to see if I could divide by zero... (+Infinity!?)
Here is the binary with the image. Also the path was changed for the image.
Here is the binary with the image. Also the path was changed for the image.

Code: Select all
Enumeration
#MWindow
#MLoadImage
#MImage
EndEnumeration
Global xScore.l,ImgX = Random(350),ImgY = Random(350)
Global sSeconds.l = 30000
UsePNGImageDecoder()
LoadImage(#MLoadImage,"\Catchme.png")
OpenWindow(#MWindow,0,0,400,400,"Score: 0",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ImageGadget(#MImage,ImgX,ImgY,50,50,ImageID(#MLoadImage),#PB_EventType_LeftClick)
Procedure sTimer()
sSeconds.l-10
Debug sSeconds.l
If sSeconds.l <= 0
ImgX = Random(350)
ImgY = Random(350)
ResizeGadget(#MImage,ImgX,ImgY,50,50)
If xScore >= 1
sSeconds = 30000/xScore.l+1
Else
sSeconds.l=30000
EndIf
EndIf
EndProcedure
Procedure sRandomMove()
sTimer()
Select EventType()
Case #PB_EventType_LeftClick
Delay(5)
xScore.l+1
ImgX = Random(350)
ImgY = Random(350)
SetWindowTitle(#MWindow,"Score: "+Str(xScore.l))
ResizeGadget(#MImage,ImgX,ImgY,50,50)
If xScore >= 1
sSeconds = 30000/xScore.l+1
Else
sSeconds.l=30000
EndIf
EndSelect
EndProcedure
Repeat
EventID = WaitWindowEvent(10)
sRandomMove()
Until EventID = #PB_Event_CloseWindow