ok..
first of all you need to create 3 global variables...click the variables tag on the AM menu and add 3 new integrer variables thus
Lock1
Lock2
Lock3
then
create a new empty frame
add one large hot spot
and set the unpicked lock as the picture for the spot..
see attached image A
then create 3 smaller hotspots
and place then on top of the "teeth" of the lock
one for each "tooth"
open the hotspot properties and set the first smaller hotspot variables options to
"variables the value of which must be inverted"
then add the
Lock1
variable to this spot..
then open the "advanced" window and add this code
- Code: Select all
Action.LoadAPicture Hotspot(1), "lock1a.jpg"
this changes the main lock image on the first Hotspot to show this "tooth" raised...etc (see attached image)
do this for the other two lock teeth
setting the options on the second spot to
"variables the value of which must be inverted"
add the
Lock2
variable to this spot..
then open the "advanced" window and add this code
- Code: Select all
Action.LoadAPicture Hotspot(1), "lock1b.jpg"
and the third
"variables the value of which must be inverted"
then add the
Lock3
variable to this spot..
then open the "advanced" window and add this code
- Code: Select all
Action.LoadAPicture Hotspot(1), "lock1c.jpg"
then create a new hotspot to one side..this is the spot the player will click to check the door to see if he has suceeded in opening the lock..
open the advanced window on the hotspot porperties..and add this
- Code: Select all
If Lock1 = 1 And Lock2 = 0 And Lock3 = 1 Then
Text(2).Caption = " yes that's got it.."
ElseIf Lock1 = 0 And Lock2 = 0 And Lock3 = 0 Then
Text(2).Caption = " no..i'll try again.."
Lock1 = 0
Lock2 = 1
Lock3 = 0
Else
Text(2).Caption = "test the pick.. "
Lock1 = 0
Lock2 = 1
Lock3 = 0
End If
if you want to automatically go to a new room when the lock is "picked"
you then need to add an additional line of code to the above to send the player to the next "frame" as he picks the lock-- so it now looks like this
- Code: Select all
If Lock1 = 1 And Lock2 = 0 And Lock3 = 1 Then
Text(2).Caption = " yes that's got it.."
Action.GoToFrame "OPEN_DOOR"
ElseIf Lock1 = 0 And Lock2 = 0 And Lock3 = 0 Then
Text(2).Caption = " no..i'll try again.."
Lock1 = 0
Lock2 = 1
Lock3 = 0
Else
Text(2).Caption = "test the pick.. "
Lock1 = 0
Lock2 = 1
Lock3 = 0
End If
note the addition of the
Action.GoToFrame "DOOR_OPEN"
this is what tells the game to take the player to a new "room" if the puzzle is solved
include a couple of textboxes (right click on screen add text)
so you can keep the player informed of his progress (see my example)
or use your favourite method
the first line of the code lists the correct settings for opening the lock
using the variables to represent the lock teeth being picked by the player.
this way the whole lock is reset to the incorrect settings after each wrong attempt....
note the inclusion/resetting of the variables in the above code thus
Lock1 = 0
Lock2 = 1
Lock3 = 0
this sets the lock (variables) to a locked position after each failed attempt
with some sort of provisional clue (??) this might be a mid level puzzle for some minor door or desk drawer..if you are told the soloution is "this way/that way/this way" you will be able to suss out that the best way to crack the lock...
with the soloution being
1 0 1
if you are given a clue to the on off on nature of the answer..
and you know the lock resets to an entirely wrong setting ie
0 1 0
then you can crack the lock in a vaguely logical fashion...and it's also do-able by sheer trail and error if all else fails...so it won't dead end you
hope this is usefull...
add some sound effects to the hotspots and it works very nicely without too much heavy coded spade work..