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

How to solve this problem with these variables in timeline?

Community Beginner ,
Feb 25, 2014 Feb 25, 2014

I have been making a random dice roll game in Flash CS5.

When a user rolls the dice, a random face is thrown and that value is added to score. The concept of the game is, the player must get 20 points in 10 tries. I didn't use external classes, instead I used the code in timeline.

The problem I have is the score is not getiing added up and the triesLeft variable is not decreasing by one.

I used

triesLeft--;//initial value is 10

and for the face value frames,

i used

score+=1;//initial value is 0

score+=2;

and so on...

i think the function runs only once.

this is the swf file of this game.

http://www.fastswf.com/swfs/3dLgfZI

if anybody need source files to see the problem more clearly i will upload it.

TOPICS
ActionScript
259
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
Guru ,
Feb 26, 2014 Feb 26, 2014
LATEST

i think the function runs only once.

correct.

You have to put your functionality inside a function

for example:

function rollDice(e:MouseEvent):void{

triesLeft--;

//plus anything you might need done

}

then make a movieclip/button instance on stage and add the eventlistener above to it

myButton.addEventListener(MouseEvent.CLICK, rollDice);

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