Monday, May 4th, 2009...3:38 pm
Class on 5.4.09
Only two weeks and two days left until the final is due. Make sure to get started on your code for your game so you can work out the problems you’re going to have (we willall have them).
Here is the files from class today. We added the shared object to the game so we could allow sending of messages and finished the timer so that it swapped turns when the time ran out. We also added code so that you could only press the button if it’s your turn.
At the end of class we fixed a problem with the timer where we had errors if there was a big network lag. We solved the problem by not starting the timer on both games. Instead we start it on one game and then on each TIMER event we send the new time to the other player so they can update the time.
Also I added code to countdown at the end Here is the line for count up (in the TIMER event handler timerHandler)
timerCurrent = myTimer.currentCount;
and this is for counting down
timerCurrent = myTimer.repeatCount – myTimer.currentCount; //count backwards
And here is the files:
Comments are closed.