Is there a better system for this?
Hi, I have a cheat code system for my game and currently this is the code:
on (press) {
var thingy:Boolean = false;
}
on (release) {
if (_root.mf.codes == twoly) {
_root.twolock = false;
this.thingy = true;
} else {
if (_root.mf.codes == twreee) {
_root.twolock = false;
_root.threelock = false;
this.thingy = true;
} else {
if (_root.mf.codes == fourt) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
this.thingy = true;
} else {
if (_root.mf.codes == five5) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
_root.fivelock = false;
this.thingy = true;
} else {
if (_root.mf.codes == toosixy) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
_root.fivelock = false;
_root.sixlock = false;
this.thingy = true;
} else {
if (_root.mf.codes == sevenyearsyoung) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
_root.fivelock = false;
_root.sixlock = false;
_root.sevenlock = false;
this.thingy = true;
} else {
if (_root.mf.codes == eight1) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
_root.fivelock = false;
_root.sixlock = false;
_root.sevenlock = false;
_root.eightlock = false;
this.thingy = true;
} else {
if (_root.mf.codes == ninet) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
_root.fivelock = false;
_root.sixlock = false;
_root.sevenlock = false;
_root.eightlock = false;
_root.ninelock = false;
this.thingy = true;
} else {
if (_root.mf.codes == tendyone) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
_root.fivelock = false;
_root.sixlock = false;
_root.sevenlock = false;
_root.eightlock = false;
_root.ninelock = false;
_root.tenlock = false;
this.thingy = true;
} else {
if (_root.mf.codes == unlockable) {
_root.twolock = false;
_root.threelock = false;
_root.fourlock = false;
_root.fivelock = false;
_root.sixlock = false;
_root.sevenlock = false;
_root.eightlock = false;
_root.ninelock = false;
_root.tenlock = false;
_root.Locked = false;
this.thingy = true;
} else {
this.thingy = false;
}
}
}
}
}
}
}
}
}
}
if (this.thingy == true) {
_root.txtx = "It worked";
}
if (this.thingy == false) {
_root.txtx = "Wrong code";
}
}
I am wondering if there is a way to make this more condense or not.