1 Reply Latest reply on Apr 28, 2015 7:15 AM by Ned Murphy

    Flash Develop ActionScript 2: Creating a boolean to check if an answer has been given

    XenoHarry

      So I am currently creating a game in FlashDevelop ActionScript 2, in the game when the player comes into contact with the washing machine the player goes to another screen and answers a question. Once they have answered the question they are taken back to the game to continue, they must then answer all required questions in order to complete the game. However when the player answers a question and are taken back to the game the software thinks that you still haven't answered the question and makes you take it again Here is the code that I am using which is relative to my problem:

      static var level:Platform; 

      //This calls the movieclip I made

      static function main(mc:MovieClip):Void

      { 

      level = new Platform(); 

      }  public function Platform()

      {

      //Creating the variable for the movement details

      var keyListener:Object = new Object();

      var redraw:Object = new Object(); 

      //Variables to hold the score

      var score:Number = 0;

      var timerstore:Number = 0;

      //Booleans to check if the user has answered the questions

      var washerquestion:Boolean = false;

      var tvquestion:Boolean = false;

      var windowquestion:Boolean = false;

      var lampquestion:Boolean = false; 

      redraw = function():Void

      {

      if (_root.player.hitTest(_root.washer))

      {

      if washerquestion = false;

      {

      washerquestion = true;

      _root.gotoAndStop(5);

      }

      if washerquestion = true;

      {

      //Do nothing

      }

      }

        if (_root.player.hitTest(_root.tv))

      {

      _root.gotoAndStop(6);

      tvquestion = true;

      }

      if (_root.player.hitTest(_root.window))

      {

      _root.gotoAndStop(7);

      windowquestion = true;

      } 

      if (_root.player.hitTest(_root.lamp))

      {

      //Removes the players character

      _root.player.unloadMovie();

      //This takes the player to the end screen

      _root.gotoAndStop(4);

      lampquestion = true;

      }

      _root.Finalscoretext.text = score; 

      }; 

      //The redraw function is instigated by the interval timer

      timerstore = setInterval(redraw, 1);

      }

      }

      I used Vectorian Giotto to create the movieclips,

      Please help me