A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Really newbie question.

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    1

    Really newbie question.

    So, I'm making a flash game, its a quiz game. I want lives in it, so when you miss a question you loose a life.

    I cant find anything that can help me..

    What I want to ask is, is there anyway to make a movie clip with say;

    Frame 1;
    Lives: 3

    Frame 2;
    Lives: 2

    Frame 3
    Lives: 1

    Then a game over page.

    How would I go about doing this? Everytime I do it, it just counts the question as a right answer and goes to the next frame.

    Here is the code I am using.

    on(release){
    gotoAndStop("lives", 2);
    }

    What am i doing wrong?

  2. #2
    Member
    Join Date
    Aug 2012
    Posts
    55
    first create a text box and set it to dynamic text. set the variable name to lives. remember to set an instance name. set your lives = 3. then set a var for your answer. if (answer == false) { lives --; }

  3. #3
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    yeah do the frames thing, add an extra frame 4 though that has 0 lives and than code that frame like onEnterFrame gotoAndStop(whateverframe) get me?

  4. #4
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Do what rachelg said. Don't need to use movieclips or frames. Just use the first frame, make a Dynamic Textbox with the variable name to lives Then put this script on the 1st frame:
    var lives=3;
    And everytime you get a wrong answer put this:
    lives--;
    You can then add a frame with the "GAME OVER" thing. Then in the first frame again add this lines:
    stop();
    onEnterFrame=function(){
    if(lives==0){
    gotoAndStop(2);
    }
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center