Thursday, 24 April 2014

Working Processes: Finalising the Game - Adding vending arrow, Fixing the timer

I realised that it may not be obvious to all users straight away that they can click the bottom of the vending machine to get to the dispenser. To make it more noticable, instead of adding an arrow which is always visible. I changed the over state of the button at the bottom of the vending machine so that an arrow will appear if the users mouse is over the button [at the bottom of the vending machine].




Whilst getting the music to work, and note overlap itself once the user goes back to the menu, I discovered a glitch.

The timer which I have put in place goes faster the more times you visit the menu. The reason for this is that the fl_SecondsElapsed++; is called once again.

To fix this issue, I created a boolean and inserted the Timer and EventListener inside it's if(statement)

 I used the following code:

if (!timerSet) {
    var fl_TimerInstance:Timer=new Timer(1000,3000);
    fl_TimerInstance.addEventListener(TimerEvent.TIMER, fl_TimerHandler);
    timerSet=true;
}


With this, the timer would now only be called once if it's on false. After the timer is called the boolean is set to true and now it will no longer recall the timer.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.