actionscript 3 - AS3 child issue with if statements -
Okay, someone can tell what is wrong in my code below, there is no error, but this is not the case Doing what i want to do I need to display a movieclip on the screen when a variable called "veridant", which is generated randomly, is greater than or equal to 0.5. If it is not, then it is not displayed. Code: This code should work: Then you will definitely add the Hope it helps! addEventListener (Event .ENTER_FRAME, char_coll); Function char_coll (ev: event): zero {if (currentFrame == 2) {if (Randint> = 0.5) {var w1: woman1 = new female1 (); Randint = Math Random (); If (w1.hitTestObject (stand)) {w1.gotoAndPlay (1); Cash 1 = cash 1 + 1; }}}};
randink is set inside the if statement. This means that the
randink is always undefined, because it
& gt; = 0.5 has to be set to any value (like a hold 22).
addEventListener (Event.ENTER_FRAME, char_coll); Function char_coll (ev: event): zero {if (currentFrame == 2) {var randint: number = Math.random (); If (Randint> = 0.5) {var w1: woman1 = New female 1 (); Stage.addChild (w1); If (w1.hitTestObject (stand)) {w1.gotoAndPlay (1); Cash 1 = cash 1 + 1; }}}};
w1 to the forum using the
addChild () as you would see below the < Code> w1 can: Female 1 = new female 1 ();
Comments
Post a Comment