TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
Scoring system that returns to previous score if you die?
Pages:
1
Scoring system that returns to previous score if you die?
User1111
Posts: 4
November 08, 2018, 12:58:00 pm
I have a basic score counter for a game I'm making as a group project finished. What I want to know now is how to do this:
After the player completes level 1, the score they had is saved somewhere. If the player fails level 2, then level 2 restarts and the score from the end of level 1 is retrieved.
Thanks
dreph
Posts: 142
November 08, 2018, 01:12:33 pm
The easiest approach for this is to store these scores as two attributes. You can have a currentScore attribute and a lastScore attribute.
Have the lastScore be a game attribute, and the currentScore attribute as the score value that is tracked. At the end of each level, set lastScore to currentScore, then if they die or have to restart, make sure the scene sets currentScore to lastScore attribute.
That should do it.
User1111
Posts: 4
November 14, 2018, 11:24:43 am
I have an idea of what I'm supposed to do now, but I still don't know what exactly I have to do with the blocks to make it happen. Could someone explain with even more detail?
NerdinaNutshell
Posts: 251
November 14, 2018, 05:45:56 pm
Use two global attributes and ONLY UNTIL after the player completes level one set the global attribute to that score. When they die in level 2 set the score back to the global attribute
*Puff*
orbinho11
Posts: 13
November 16, 2018, 05:12:00 am
Use global attributes and save your gae after the end of each level, when you fail the level, load the game. All global attributes will go back to the value it was saved.
User1111
Posts: 4
November 18, 2018, 01:44:53 pm
I know I have to use global attributes now, but how do I actually "get" the current score from the level when a level win triggers this event?
User1111
Posts: 4
November 18, 2018, 02:26:12 pm
Nevermind, just got it working. Thanks for all of your input.
Pages:
1