2014년 12월 6일 토요일

Trying to call a global variable on another screen + Display problem

I'm trying to make a random number game and this requires you to guess a number, get it right - it directs you to one screen and get it wrong... well that's
where my problems start, the problems are:

  • I have a retry and score label which displays the score and the number of retries left and when the screen first initializes this is set to 10 and 100 respectively but if they get it wrong then it is supposed to take away 1 and 10 from them and whilst it does that it still has the previous value in the label so instead of being 90 for example it is 10090 !!!
    • My other problem is that I can't call a global, NOT local as some may point out, variable on another screen when I try to do so the drop down list is blank and a tick is on the left and this means that for other screens such as the Game Over screen where I am supposed to display the score I can't - a major problem.
    Please help as soon as possible because this is due in within a three days and to finish I need the correct code otherwise - FAIL.  




    Global variables are only global for the screen they're on...   They don't pass to other screens.  If you need persistent data, use a TinyDB on both screens.

    If you get your computation for the tries into a variable, and then set the label.text to that variable, it'll only show the contents of the variable. 


    댓글 없음:

    댓글 쓰기