currMode = ""
comPno = "COM3:"
comPmode = "9600,N,8,1,ASC"
CreateButtons
DisplayButtons
' If the mouse was clicked check if it was selecting a tile, clicking a button or putting a tile on the map
currMode = CheckButtons
si = 0
_Dest speedBtn
(si
).imageH
speedBtn(si).x = 10
speedBtn(si).y = 10
speedBtn(si).w = 64
speedBtn(si).h = 32
speedBtn(si).code = "slow"
si = 1
_Dest speedBtn
(si
).imageH
speedBtn(si).x = 110
speedBtn(si).y = 10
speedBtn(si).w = 64
speedBtn(si).h = 32
speedBtn(si).code = "med"
si = 2
_Dest speedBtn
(si
).imageH
speedBtn(si).x = 210
speedBtn(si).y = 10
speedBtn(si).w = 64
speedBtn(si).h = 32
speedBtn(si).code = "fast"
_PutImage (speedBtn
(si
).x
, speedBtn
(si
).y
), speedBtn
(si
).imageH
CheckButtons = ""
If RectCollide
(mousePos.x
, mousePos.y
, 1, 1, speedBtn
(si
).x
, speedBtn
(si
).y
, speedBtn
(si
).w
, speedBtn
(si
).h
) Then CheckButtons = speedBtn(si).code
rect1X2 = rect1X + rect1Width - 1
rect1Y2 = rect1Y + rect1Height - 1
rect2X2 = rect2X + rect2Width - 1
rect2Y2 = rect2Y + rect2Height - 1
RectCollide = 0
RectCollide = -1