Search Results

Search found 1 results on 1 pages for 'madrusec'.

Page 1/1 | 1 

  • Running game, leaving game and continuing animation

    - by Madrusec
    I have been trying to learn some Actionscript recently and have been trying to run an interactive story that at one point turns into an extremel simple shooter game. After the player either wins or looses, then he/she is taken to the rest of the animated story. So I have everything up to the point where the games runs (successfully) but for some reason I am unable to have flash run the rest of the frames, most of which have no code at all. This is the code for scene 1: stop (); import flash.display.MovieClip; import flash.events.MouseEvent; import flash.utils.Timer; import flash.events.TimerEvent; var stoneInGame:uint; var stoneMaker: Timer; var container_mc: MovieClip; var cursor:MovieClip; var score:int; var anxiety:int; var anxiety_mc :MovieClip = new mcAnxiety(); //stage.addChild( anxiety_mc ); function initializeGame():void { stoneInGame = 10; stoneMaker = new Timer(1000, stoneInGame); container_mc = new MovieClip(); addChild(container_mc); container_mc.addChild(anxiety_mc); anxiety_mc.x = 497; anxiety_mc.y = 360; stoneMaker.addEventListener(TimerEvent.TIMER, createStones); stoneMaker.start(); cursor = new Cursor(); addChild(cursor); cursor.enabled = false; Mouse.hide(); stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor); score = 0; anxiety = anxiety_mc.totalFrames; anxiety_mc.gotoAndStop(anxiety); } function dragCursor(event:MouseEvent):void { cursor.x = this.mouseX; cursor.y = this.mouseY; } function createStones(event:TimerEvent):void { var stone:MovieClip; stone = new Stone(); stone.x = Math.random() * stage.stageWidth; stone.y = Math.random() * stage.stageHeight; container_mc.addChild(stone); } function increaseScore():void { score ++; if(score >= stoneInGame) { dragCursor.stop(); createStones.stop(); stoneMaker.stop(); trace("you wind!"); } } function decreaseAnxiety():void { anxiety--; if(anxiety <= 0) { stoneMaker.stop(); trace("you lose!"); } else { anxiety_mc.gotoAndStop(anxiety); } increaseScore(); } initializeGame(); So what I tried to do was adding gotoAndPlay() inside both the decreaseAnxiety and increaseScore functions after the trace statements and referenced a frame where I have more keyframes that continue a story. However, Flash just goes back to the beginning of the timeline and I even the functions that change and control the cursor seem to be running. This leads me to believe that I need to make sure that I tell flash o stup running certain functions before jumping to another frame. However, it seems to me that I would still have the same issue and not be able to continue in the timeline. Is there something I am missing? How can I jump out of all this code once the game finishes and simply continue playing the rest of the frames? Any pointers would be greatly appreciated. Thank you

    Read the article

1