Bug with loadVars when creating high score

Non-platform specific questions.

Bug with loadVars when creating high score

Postby SanDiego1 » Fri Nov 25, 2005 3:23 pm

I followed the tutorial and created a high score. In my game, the player's score increases by incriments of 100 when certain buttons are pressed and decreases by incriments of 50 when other buttons are pressed. After the player plays the game once and the high score is loaded, the score goes from 0 to some random number like 35084720 when the first button is pressed on the second play of the game. Thereafter, the score will increase by 100 and decrease by 50 with the other buttons. This seems to happen because of the loadVars function. Is there some other way to load or create a high score without the loadsVars function?
SanDiego1
 
Posts: 20
Joined: Wed Oct 12, 2005 1:08 am
Score: 0 Give a positive score

Postby makslane » Fri Nov 25, 2005 9:23 pm

I can't repeat this error here.
Can you send me the game?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby SanDiego1 » Sat Nov 26, 2005 12:20 am

Thanks for the help. I think I figured it out. I had put the "Score.textNumber = Score.textNumber + 100" in a Mouse Up Button event. I need the player to mouse click a button to change the score. What I did was put the code in the Script Editor for both the Mouse Up Button event and the Create Actor event. I did this for each button that the player uses to increase/decrease the score. At the end of the game, I have the player left click the final piece of the board so his score is compared with the high score. I again put the same code in the Mouse Up Button event and the Create Actor event. The code compared the high score with the score. On the high score, I loaded the variable using loadVars and the "text.Number = highScoreCount" and it worked. I hope this helps others who need to activate the score with a mouse click rather than a collision.
SanDiego1
 
Posts: 20
Joined: Wed Oct 12, 2005 1:08 am
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest