'Build the flower!
'------------INTERFACE----------------'
Sub interface
'Window set up--Width,height,ect---
GraphicsWindow.Width=500
GraphicsWindow.Height=500
'Set up with Graphicswindow.Contol (Container for the dragable shapes)
GraphicsWindow.DrawRectangle(370,1,130,498)
GraphicsWindow.DrawRectangle(370,1,130,100)
GraphicsWindow.DrawRectangle(370,1,130,200)
GraphicsWindow.DrawRectangle(370,1,130,300)
GraphicsWindow.DrawRectangle(370,1,130,400)
EndSub
Sub MoveRotate
'Now for the opage flower--the tough part.(ish)Set the colors here!
GraphicsWindow.BrushColor="Pink"
pedal1=Shapes.AddEllipse(45,30)
pedal2=Shapes.AddEllipse(45,30)
pedal3=Shapes.AddEllipse(45,30)
GraphicsWindow.BrushColor="Yellow"
core=Shapes.AddEllipse(30,30)
GraphicsWindow.BrushColor="Brown"
stem1=Shapes.AddRectangle(10,70)
'Set opacity
Shapes.SetOpacity(pedal1,20)
Shapes.SetOpacity(pedal2,20)
Shapes.SetOpacity(pedal3,20)
Shapes.SetOpacity(core,20)
Shapes.SetOpacity(stem1,20)
'Rotate the pedals
Shapes.Rotate(pedal1,60)
Shapes.Rotate(pedal2,-60)
Shapes.Rotate(pedal3,90)
'Now, move the pedals and the rest.
'Jibba Jabba's given sample, modified. :3
interface()
'-----------------------------------Declare some Variables-------------------------------------------------------------------------------
'Name 5 location x's and y's for the shapes!
'pedalA
X1 = 500- 45 - 10'
Y1 = 40
'pedalB
X2 = 500-45-10
Y2 = 140
'pedalC
X3 = 500-45-10
Y3 = 240
'coreA
X4=500-30-10
Y4=340
'stemA
X5=500-10-10
Y5=420
'-------------------------------------Declare Event Handlers----------------------------------------------------------------------------
GraphicsWindow.MouseDown = MouseDown
GraphicsWindow.MouseMove = MouseMove
GraphicsWindow.MouseUp=MouseUp
'mane program
MoveRotate()
'--------------------------------------Event Handlers-------------------------------------------------------------------------------------
'Copy/paste certain code for other shapes!
Sub MouseDown
pos_X = GraphicsWindow.MouseX
pos_Y = GraphicsWindow.MouseY
If pos_X > X1 And pos_X < X1 + 45 And pos_Y > Y1 And pos_Y < Y1 + 30 Then
selected = "pedalA"
EndIf
If pos_X > X2 And pos_X < X2 + 45 And pos_Y > Y2 And pos_Y < Y2 + 30 Then
selected = "pedalB"
EndIf
If pos_X > X3 And pos_X < X3 + 45 And pos_Y > Y3 And pos_Y < Y3 + 30 Then
selected = "pedalC"
EndIf
If pos_X > X4 And pos_X < X4 + 45 And pos_Y > Y4 And pos_Y < Y4 + 30 Then
selected = "coreA"
EndIf
If pos_X > X5 And pos_X < X5 + 45 And pos_Y > Y5 And pos_Y < Y5 + 30 Then
selected = "stemA"
EndIf
EndSub
Sub MouseMove
x = GraphicsWindow.MouseX
y = GraphicsWindow.MouseY
If Mouse.IsLeftButtonDown And selected = "pedalA" Then
Shapes.Move(pedalA, x, y)
EndIf
If Mouse.IsLeftButtonDown And selected = "pedalB" Then
Shapes.Move(pedalB, x, y)
EndIf
If Mouse.IsLeftButtonDown And selected = "pedalC" Then
Shapes.Move(pedalC, x, y)
EndIf
If Mouse.IsLeftButtonDown And selected = "coreA" Then
Shapes.Move(coreA, x, y)
EndIf
If Mouse.IsLeftButtonDown And selected = "stemA" Then
Shapes.Move(stemA, x, y)
EndIf
EndSub
Sub MouseUp
If Mouse.IsLeftButtonDown="False" And selected="pedalA" Then
Shapes.Remove(pedalA)
Shapes.SetOpacity(pedal1,100)
EndIf
If Mouse.IsLeftButtonDown="False" And selected="pedalB" Then
Shapes.Remove(pedalB)
Shapes.SetOpacity(pedal2,100)
EndIf
If Mouse.IsLeftButtonDown="False" And selected="pedalC" Then
Shapes.Remove(pedalC)
Shapes.SetOpacity(pedal3,100)
EndIf
If Mouse.IsLeftButtonDown="False" And selected="coreA" Then
Shapes.Remove(coreA)
Shapes.SetOpacity(core,100)
EndIf
If Mouse.IsLeftButtonDown="False" And selected="stemA" Then
Shapes.Remove(stemA)
Shapes.SetOpacity(stem1,100)
EndIf
EndSub