Microsoft Small Basic

Program Listing: BPF583
GraphicsWindow.BrushColor="teal
GraphicsWindow.Title="Trainspotting2...
GraphicsWindow.BackgroundColor ="teal
GraphicsWindow.Width=1200
GraphicsWindow.Height =700
GraphicsWindow.MouseMove=mww
For x=0 To 7
w[x]=Shapes.AddRectangle (35 15)
LDDialogs.ToolTip (w[x] x)
t=x+34
w[t]=Shapes.AddRectangle (35 15)
LDDialogs.ToolTip (w[t] t)
Shapes.Move (w[t] 350+x*45 420)
t=24-x
w[t]=Shapes.AddRectangle (35 15)
LDDialogs.ToolTip (w[t] t)
Shapes.Move (w[x] 350+x*45 400)
Shapes.Move (w[t] 350+x*45 35)

EndFor
For x=0 to 40
nx[x]=x+1
endfor
nx[41]=8
'nx[33]=0

pl=Shapes.AddRectangle (45 10)
Shapes.Move (pl 350 320)
LDShapes.SetShapeEvent (pl)
LDDialogs.ToolTip (pl "Closed")
LDShapes.RotateAbout (pl 350 320, 45)

p350=650
pl1=Shapes.AddRectangle (45 10)
Shapes.Move (pl1 p350 320)
LDShapes.SetShapeEvent (pl1)
LDDialogs.ToolTip (pl1 "Closed")
LDShapes.BrushColour (pl1 "Red")
'LDShapes.RotateAbout (pl1 350 320, 45)
cl=1
LDShapes.ShapeEvent=see
f10=15
f90=90
For x=2 To 10
t=18-x
w[t]=Shapes.AddRectangle (35 15)
LDDialogs.ToolTip (w[t] t)
Shapes.Move (w[18-x] 620+LDMath.Cos(x*f10-f90)*195 LDMath.sin(x*f10-f90)*195+220 )
Shapes .Rotate (w[18-x] x*f10)
EndFor

For x=2 To 10
t=35-x
w[t]=Shapes.AddRectangle (35 15)
LDDialogs.ToolTip (w[t] t)
Shapes.Move (w[t] 400+LDMath.Cos(x*f10+f90)*195 LDMath.sin(x*f10+f90)*195+220 )
Shapes .Rotate (w[t] x*f10)
EndFor




x=0

For y=1 to 3
cp[y]= y-1
cp1[y]= y+35
endfor
ac="true
ac1="true
While "true"' ========================loop----------------------
If ac then
For y=1 to 3

cp[y]= nx[cp[y]]
t= cp[y]
LDShapes.BrushColour (w[t] "red")

EndFor
If cp[3]=41 and cl=1 then
ac="false

endif
endif

If ac1 then
For y=1 to 3

cp1[y]= nx[cp1[y]]

t= cp1[y]
LDShapes.BrushColour (w[t] "cyan")
EndFor
If cp1[3]=41 and cl=1 then
ac1="false

endif
endif

If ac or ac1 Then

Program.Delay (250)
if ac then
tdel()
EndIf
if ac1 then
tdel1()
EndIf
endif
endwhile'================================================****

Sub tdel
For y=1 to 3
t=cp[y]
LDShapes.BrushColour (w[t] "teal")
EndFor
EndSub

Sub tdel1
For y=1 to 3
t=cp1[y]
LDShapes.BrushColour (w[t] "teal")
EndFor
EndSub

Sub see
If LDShapes.LastEventType="MouseDown" then
If LDShapes.LastEventShape=pl then
sw=1-sw
If sw=1 then
LDDialogs.ToolTip (pl "Open")
LDShapes.RotateAbout (pl 350 320, 45)
nx[33]=34
Else
LDDialogs.ToolTip (pl "Closed")
LDShapes.RotateAbout (pl 350 320, 0)
nx[33]=0
EndIf
ElseIf LDShapes.LastEventShape=pl1 then
cl=1-cl
If cl=0 then
LDDialogs.ToolTip (pl1 "Open")
LDShapes.RotateAbout (pl1 p350 320, -45)
LDShapes.BrushColour (pl1 "Lime")
ac="true
tdel()
ac1="true
tdel1()
Else
LDDialogs.ToolTip (pl1 "Closed")
LDShapes.RotateAbout (pl1 p350 320, 0)
LDShapes.BrushColour (pl1 "Red")
EndIf
endif
endif
EndSub

Sub mww
' GraphicsWindow.Title=GraphicsWindow.MouseX +" : "+GraphicsWindow.MouseY
EndSub