Page 1 of 1

Keeping score between two cards

Posted: Sat Jan 04, 2014 9:31 pm
by Bobby666
Hey everyone!:)

My question is : How can I keep the score between two cards?
In my game , when the user intersects a "Questionbox" with my player a new card appears with a question , and when the user goes back the the card "Level1" where he intersected the "Questionbox" the score is empty. However he needs a number of "Diamants" to go to the next card. ( The score is in a global variable)

I hope everyone understands my question:)
Thank you for answers:)

Re: Keeping score between two cards

Posted: Sat Jan 04, 2014 11:44 pm
by jmburnod
Hi,
If the score is in a global variable then you can get it from all script of your stack.
You have simply to declare this global in front of script

Best regards
Jean-Marc

Re: Keeping score between two cards

Posted: Sun Jan 05, 2014 5:05 pm
by Bobby666
Hey:)

The problem is I declared this global in front of my script, but when I change the card and i come back the score is empty and the "Diamants" are not visible (what is correct). I don't know why the score is empty:D Livecode says that the code is correct but it doesn't work "correct" for me:D

the code is

on collectD
if intersect (button "mSprite" , button "Diamant" , "pixels" ) then
if enabled of button "Diamant" then
add 1 to numDiamants
put numDiamants into the field "numDiamants"
end if
hide button "Diamant"
disable button "Diamant"
end if
end collectD

It doesn't keep the score :(

Re: Keeping score between two cards

Posted: Sun Jan 05, 2014 5:21 pm
by Klaus
HI Bobby,

check this thread, I think this is your problem:
http://forums.runrev.com/phpBB2/viewtop ... are#p87045


Best

Klaus

Re: Keeping score between two cards

Posted: Mon Jan 06, 2014 9:40 pm
by Bobby666
Thank you very much! That was my problem! :D

Re: Keeping score between two cards

Posted: Mon Jan 06, 2014 11:23 pm
by Klaus
Hey, cool, I'm making progress in "clairvoyance"! :D