Thank you for visiting Blazing Games

Coding lock components

The lock combo movie is fairly simple and simply has the two buttons call the nextNumber and previousNumber functions. These functions call the setNumber function which handles the rotation of the wheel if rotated past the minimum or maximum numbers. The getNumber function is used by the combination lock implementation to determine which number the segment is set for.

next_btn.onRelease = nextNumber;
previous_btn.onRelease = previousNumber;
if (currentValue == undefined)
setNumber(0);

function setNumber(n)
{
if ( (n < 1) || (n > 9))
currentValue = 10;
else
currentValue = n;

gotoAndStop(currentValue);
}

function getNumber()
{
if (currentValue == 10)
return 0;
return currentValue;
}

function nextNumber()
{
if (currentValue == 10)
setNumber(1);
else
setNumber(currentValue + 1);
}

function previousNumber()
{
setNumber(currentValue - 1);
}

The actual combination is simply five of the wheels combined together. To determine if the player has entered the proper combination, one simply has to check the five separate wheels and see if they match the combination.

Previous page
Chapter 25 Page 5

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