- Home /
Getting my point counter to work
I'm at a loss here, I'm desperately trying to get the game to increase the point score by 1 for every 2 seconds that pass that the character avatar is moving, and to decrease by 1 point for every 2 seconds he is not moving.
The tutorial book I'm reading gives me no hints on how to so much as cause Text GUI's to change in appearance (EG: to start as reading: 0, then changing to 1, then 2, then 3 and so on and so forth when conditions are met)
I have a general idea on how the structure of the code would work, I'd need to call upon the scripts for character movement so that when the conditions for moving are met then so are the conditions for increasing point score, and when they aren't met, then the score decreases.
Once that's called upon it'd be something like
function Update () { if (movement=true){ pointscore= pointscore+1; text=pointscore; }
else{
pointscore= pointscore=1;
text=pointscore;
} }
can somebody tell me how to get this to work?
Answer by Wotan · Sep 18, 2010 at 09:04 PM
Ok, I thought you have problems with calculating your score.
Unfortunately my knowledge about GUI is very limited. I guess you have to update your GUI in the OnGUI() method. Is the value of your pointscore correct if you trace it in the OnGUI method (e.g. by using Debug.Log())?
Well that's kinda a problem, because all that code I put up there is just how I EXPECT it to form. I've got no idea how to even begin here and that's why I'm asking here. I couldn't make heads nor tails of the turtorial in the book I'm using which doesn't even USE text gui, it's just texture gui, so I'm clueless here :(
Your answer