Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

messages should come when score is 100,200,300 ....

Guest
Mar 24, 2014 Mar 24, 2014

Hi, i am student and developing a project for my acadamic and i need to get the messages like wow, good, superb etc... when my score is 100, 200, 300 and so on... somebody help me out to over come this...

TOPICS
ActionScript
520
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2014 Mar 24, 2014

What code do you have so far for processing the scores?  Wherever you change the score value you should be checking the value to see if it requires generating one of the messages.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 24, 2014 Mar 24, 2014

hi ned,

check my code and revert me back with solution. thanks a  lot for ur replay.

code:

var myHighScore:int;// high score variable

var soScores:SharedObject = SharedObject.getLocal("mycookie");

var score = 0;

if (soScores.data.myHighScore != null)

{

          myHighScore = soScores.data.myHighScore;

}

var ttlScore:int = 0; // total score variable.

zCubeScore.text = "Score: " + local_cube;

zMemLaneScore.text = "Score: " + local_match2;

zMemMathScore.text = "Score: " + local_math2;

zPPatchScore.text = "Score: " + local_ppatch;

zPicSeqScore.text = "Score: " + local_picSequence;

zTotalScore.text = "Score: "+(local_cube+

  local_match2+

  local_math2+

  local_ppatch+

  local_picSequence

  );

ttlScore = local_cube + local_match2 + local_math2 + local_ppatch + local_picSequence;

if (soScores.data.myHighScore != null)

{

          myHighScore = soScores.data.myHighScore;

}

if (myHighScore == ttlScore == 0)

{

          myHighScore = 0;

}// the highscore that is saved on the computer.

if (ttlScore > myHighScore)

{

          myHighScore = ttlScore;

          soScores.data.myHighScore = ttlScore;

          soScores.flush();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2014 Mar 24, 2014

"check my code and revert me back with solution"

Are you asking me or telling me?... in either case, I will not be solving your school work for you, but I will try to help you find the solution.  You will have to start by indicating where the score value is in your code that you want to base the messages on, and also show where the value changes... that is where you need to check if it equals 100, 200, etc....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 24, 2014 Mar 24, 2014

Use mod. if(score % 100 == 0) then show your wow text, etc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2014 Mar 25, 2014
LATEST

The snippet below show one of the ways how you can match score with a feedback word:

// array containig feedback strings

var feedbacks:Array = ["lame", "good", "wow", "sipurb", "unbelievable"];

// example of score value

var score:int = 1000;

/**

* value that will be used to retrieve feedback string

* note - resutling index value will not exceed the index of the last element of

* feedback array

*/

var index:int = Math.min(score / 100, feedbacks.length - 1);

trace(feedbacks[index]);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines