PDA

View Full Version : F5 actionscript help



JcDenton93
July 14th, 2004, 03:11 PM
Dear reader,
I have been trying to make an RPG game:mario: for quite some time, what is the code so that the money dosen't go under zero???Please help.

thoriphes
July 14th, 2004, 03:45 PM
function deduct() {
if (money > 0) {
money--;
return true;
} else {
return false;
}
}Made it a function just in case any animation for the deduction (like a counter going down) is required. Returns true or false determining whether or not the deduction was successful.

senocular
July 14th, 2004, 03:56 PM
or

money = Math.max(money, 0);

thoriphes
July 14th, 2004, 04:05 PM
:bad: oh yeah?

money = (money > 0) ? money : 0;

senocular
July 14th, 2004, 04:07 PM
thor wins :hangover:

:pleased:

thoriphes
July 14th, 2004, 04:08 PM
:love: