P
Preschool Mike
I'm trying to design a puzzles (e.g., my design: imagine a 3 x 3 table -
where the table contains 8 pieces of the puzzle. The puzzle type is the kind
where you slide the pieces around until you get the completed image minus the
9th piece. Once all 8 pieces are in their correct spot the ninth piece will
appear). While the code below will make the ninth piece appear once the
other eight have been placed in their correct spot. Because of the type of
puzzle (e.g., constantly moving pieces - a piece can be placed in the correct
spot and then moved out of the correct spot it's possible for the last
picture to appear even when some of the pieces are incorrectly placed -
because they had previously been placed in the correct spot. In short I need
the last piece to only appear when all eight are simotaneously in their
correct spot. Here's what I've got so far. Hope I've been clear enough.
Dim Done1 As Boolean
Dim Done2 As Boolean
Dim Done3 As Boolean
Dim Done4 As Boolean
Dim Done5 As Boolean
Dim Done6 As Boolean
Dim Done7 As Boolean
Dim Done8 As Boolean
Sub MoveTheShapeTo(theAnswerBox As Shape)
MyShapePicture.Top = theAnswerBox.Top + 0
MyShapePicture.Left = theAnswerBox.Left + 0
If MyShapePicture.Name = "A1" And theAnswerBox.Name = "AnswerBox1a" Then
Done1 = True
ElseIf MyShapePicture.Name = "A2" And theAnswerBox.Name = "AnswerBox1b"
Then
Done2 = True
ElseIf MyShapePicture.Name = "A3" And theAnswerBox.Name = "AnswerBox1c"
Then
Done3 = True
ElseIf MyShapePicture.Name = "B1" And theAnswerBox.Name = "AnswerBox2a"
Then
Done 4 = True
ElseIf MyShapePicture.Name = "B2" And theAnswerBox.Name = "AnswerBox2b"
Then
Done5 = True
ElseIf MyShapePicture.Name = "B3" And theAnswerBox.Name = "AnswerBox2c"
Then
Done6 = True
ElseIf MyShapePicture.Name = "C1" And theAnswerBox.Name = "AnswerBox3a"
Then
Done7 = True
ElseIf MyShapePicture.Name = "C2" And theAnswerBox.Name = "AnswerBox3b"
Then
Done8 = True
End If
CheckAnswer
End Sub
Sub CheckAnswer()
If Done1 = True And Done2 = True And Done3 = True And Done4 = True And Done5
= True And _
Done6 = True And Done7 = True And Done8 = True Then
ShowPicture
End If
End Sub
Sub ShowPicture()
Dim oSld As Slide
On Error Resume Next
For Each oSld In ActivePresentation.Slides
oSld.Shapes("C3").Visible = True
Next
On Error GoTo 0
End Sub
Sub Initialize()
Done1 = False
Done2 = False
Done3 = False
Done4 = False
Done5 = False
Done6 = False
Done7 = False
Done8 = False
ResetPictures
ActivePresentation.SlideShowWindow.View.Next
End Sub
where the table contains 8 pieces of the puzzle. The puzzle type is the kind
where you slide the pieces around until you get the completed image minus the
9th piece. Once all 8 pieces are in their correct spot the ninth piece will
appear). While the code below will make the ninth piece appear once the
other eight have been placed in their correct spot. Because of the type of
puzzle (e.g., constantly moving pieces - a piece can be placed in the correct
spot and then moved out of the correct spot it's possible for the last
picture to appear even when some of the pieces are incorrectly placed -
because they had previously been placed in the correct spot. In short I need
the last piece to only appear when all eight are simotaneously in their
correct spot. Here's what I've got so far. Hope I've been clear enough.
Dim Done1 As Boolean
Dim Done2 As Boolean
Dim Done3 As Boolean
Dim Done4 As Boolean
Dim Done5 As Boolean
Dim Done6 As Boolean
Dim Done7 As Boolean
Dim Done8 As Boolean
Sub MoveTheShapeTo(theAnswerBox As Shape)
MyShapePicture.Top = theAnswerBox.Top + 0
MyShapePicture.Left = theAnswerBox.Left + 0
If MyShapePicture.Name = "A1" And theAnswerBox.Name = "AnswerBox1a" Then
Done1 = True
ElseIf MyShapePicture.Name = "A2" And theAnswerBox.Name = "AnswerBox1b"
Then
Done2 = True
ElseIf MyShapePicture.Name = "A3" And theAnswerBox.Name = "AnswerBox1c"
Then
Done3 = True
ElseIf MyShapePicture.Name = "B1" And theAnswerBox.Name = "AnswerBox2a"
Then
Done 4 = True
ElseIf MyShapePicture.Name = "B2" And theAnswerBox.Name = "AnswerBox2b"
Then
Done5 = True
ElseIf MyShapePicture.Name = "B3" And theAnswerBox.Name = "AnswerBox2c"
Then
Done6 = True
ElseIf MyShapePicture.Name = "C1" And theAnswerBox.Name = "AnswerBox3a"
Then
Done7 = True
ElseIf MyShapePicture.Name = "C2" And theAnswerBox.Name = "AnswerBox3b"
Then
Done8 = True
End If
CheckAnswer
End Sub
Sub CheckAnswer()
If Done1 = True And Done2 = True And Done3 = True And Done4 = True And Done5
= True And _
Done6 = True And Done7 = True And Done8 = True Then
ShowPicture
End If
End Sub
Sub ShowPicture()
Dim oSld As Slide
On Error Resume Next
For Each oSld In ActivePresentation.Slides
oSld.Shapes("C3").Visible = True
Next
On Error GoTo 0
End Sub
Sub Initialize()
Done1 = False
Done2 = False
Done3 = False
Done4 = False
Done5 = False
Done6 = False
Done7 = False
Done8 = False
ResetPictures
ActivePresentation.SlideShowWindow.View.Next
End Sub