Thank you for visiting Blazing Games

The Slot Machine Gave me a Shock

The slot machine that forms the locking mechanism for the door is fairly simple. Each slot has a button that when clicked on calls the handleSlot function passing which slot it is. The handle slot function checks the inventory mode which determines which coin is being placed there. If the player is not trying to put a coin into a slot the game assumes that the player is attempting to remove a coin. This does not really make sense when you think about it as if a coin fits in a slot you have the right slot otherwise you are dead, but at one time I was going to wait until there were five coins placed before killing the player if a coin is misplaced.

If the coin being placed is in the correct slot, then the game checks to see if all the slots are filled. If they are then the game goes to the win sequence. If not then it just continues on waiting for the player to fill the rest of the slots.

If the coin is placed in the wrong slot, then the end game sequence is played and the player is dead so they are taken back to the title.

// ***** Door puzzle functions *****

function handleSlot(n)
{
var im = inv_movie.getInventoryMode();

if (im == 0) { // removing a coin
if (ootw28.puzzleSlotState[n] == true) {
ootw28.haveCoins[n] = true;
ootw28.puzzleSlotState[n] = false;
gotoAndPlay("doorPuzzle");
}
} else { // inserting a coin
var coinID = im - 1;
if (n == coinID) {
// don't have to worry about checking if coin already there as wrong slot = lose anyways
ootw28.haveCoins[coinID] = false;
ootw28.puzzleSlotState[coinID] = true;
// check if won
var insertCount = 0;
for (var cntr = 0; cntr < 5; ++cntr)
if (ootw28.puzzleSlotState[cntr] == true)
++insertCount;
if (insertCount == 5)
gotoAndPlay("win");
else
gotoAndPlay("doorPuzzle");
} else {
gotoAndPlay("lose");
}
}
inv_movie.updateInventory();
}

function triangleSlot()
{
handleSlot(0);
}

function squareSlot()
{
handleSlot(1);
}

function pentagonSlot()
{
handleSlot(2);
}

function hexagonSlot()
{
handleSlot(3);
}

function octagonSlot()
{
handleSlot(4);
}

function returnToTitle()
{
gotoAndPlay("Title", 1);
}

Previous page
Chapter 28 Page 5

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2008 Blazing Games Inc. All Rights Reserved