Hi guys, cant get this function to work!! heres the code. Apparently its fine, but when i open the trace output window, the variables dont change!!!
stop();
gilbertPlay = 3;
gilbertHealth = 3;
function decreaseVars() {
// subtract 1 from gilbertHealth
gilbertHealth--;
// check if gilbertHealth is 0 and if so, kill
if (gilbertHealth == 0) {
_root.gotoAndStop(35);
}
// same for other vars
gilbertPlay--;
if (gilbertPlay == 0) {
_root.gotoAndStop(35);
}
}
setInterval(decreaseVars, 5000);
rattle_mc.onRelease = function() {
rattle_mc.play();
eyes_mc.gotoAndPlay(28);
gilbertPlay++;
// if gilbertPlay var = 4
if (gilbertPlay == 4) {
// set gilbertPlay var to 3
gilbertPlay = 3;
}
};
bandaid_mc.onRelease = function() {
bandaid_mc.play();
gilbertHealth++;
// if gilbertHealth var = 4
if (gilbertHealth == 4) {
// set gilbertHealth var to 3
gilbertHealth = 3;
}
};
healthStatus_mc.gotoAndStop('hc'+gilbertHealth);
playStatus_mc.gotoAndStop('pc'+gilbertPlay);
trace(gilbertPlay);
trace(gilbertHealth);
cheers!