Someone gifted MetalSlayer69 supporter status!
We need you on the team, too.
Support Newgrounds and get tons of perks for just $2.99!
Create a Free Account and then..
Become a Supporter!Dumb question time. So say I have two different sets of variables like below. In the onEnterFrame function, the variables that are ticks are added to the variables that are progs if a Boolean is true.
var veggieCommence:Boolean = false; var veggieProg:Number = 0; var veggieTick:Number = 1; var meatsCommence:Boolean = false; var meatsProg:Number = 0; var meatsTick:Number = 1; onEnterFrame = function() { if(veggieCommence) { veggieProg += veggieTick; } if(meatsCommence) { meatsProg += meatsTick; } }
I'm curious if (instead of writing two if statements) could I just put them in one function like this?
function commenceProgress(booby:Boolean, proggy:Number, ticky:Number):Void { if(booby) { proggy += ticky; } }
If not, should I just bite the bullet and write everything in one function? Did I miss something in the language reference? Apparently numbers don't let you do a method similar to points like return prog.add(tick) or something like that.
Also, Happy New Year.
Dumb question time. So say I have two different sets of variables like below. In the onEnterFrame function, the variables that are ticks are added to the variables that are progs if a Boolean is true.
var veggieCommence:Boolean = false; var veggieProg:Number = 0; var veggieTick:Number = 1; var meatsCommence:Boolean = false; var meatsProg:Number = 0; var meatsTick:Number = 1; onEnterFrame = function() { if(veggieCommence) { veggieProg += veggieTick; } if(meatsCommence) { meatsProg += meatsTick; } }
I'm curious if (instead of writing two if statements) could I just put them in one function like this?
function commenceProgress(booby:Boolean, proggy:Number, ticky:Number):Void { if(booby) { proggy += ticky; } }
If not, should I just bite the bullet and write everything in one function? Did I miss something in the language reference? Apparently numbers don't let you do a method similar to points like return prog.add(tick) or something like that.
Also, Happy New Year.