Adding points from multiple actors to the final score and best score
Hello !
Ive been reading through a few posts re scores and following peoples examples of adding scoring together but I am unable to recreate what its supposed to do for some reason, its probably something easy I am missing out .... ?!
I have two "actors", a brown nut and a golden nut that when collected by the main "actor" add up to the final score.
1 Brown nut is 2 points
2 Golden nut is 5 points
The main actor goes through a number of marker posts, adding 1 point to the main score every time, this works and shows correctly in the 'final' score.
I have created a Game Attribute for each of these, Brown, Golden and the Score, each with an Integer of 0 and added an attribute so that 2 points is awarded to the Brown nut and 5 to the Golden nut.
I have tried multiple ways of adding the attributes to the actors, so that the Brown + Golden + Score = Final Score and the final score is displayed when the game is over but it only ever adds up the marker post points ?
Is there a simplified way of doing this and where exactly do the attributes get put together ?
Any help is very much appreciated
Rob
Comments
edit: see my post below
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks for that, although something is not right? .. the score now deducts random points ?
Either I am overthinking this scoring system or missed a key ingredient out !!
Have you got email address so I can send screenshots of what I am doing please ?
@BrassMonkeysUK Sounds like you need 3 integers Score, Bonus and Final.
Had a quick play and attached a project.
Touch the nuts to add bonus and touch actor at bottom to finish and show final score (it will auto reset after 2 seconds).
You didn't need 2 different attributes for the nuts, just one is fine (Bonus), timer adds one to the score every second, when you collect either a brown or golden nut we simply change the integer Bonus to +2 or +5 depending on the nut, then at the end of the game we add the score and bonus together to find the final score. If game over is true change attribute final to bonus+score.
Hope this helps, sounds like a fun little game you're making.
Darren.
Cheers! I'll give this a shot and will let you know how it goes !
Thanks for the help !!
Rob
Sorry about that, I was a bit hasty. It should have looked like this:
In your player (squirrel?) actor, have rules that say:
If actor collides with actor brown nut change attribute game.brownScore to game.brownScore+2 change attribute game.finalScore to game.finalScore+2 If actor collides with actor golden nut change attribute game.goldenScore to game.goldenScore+5 change attribute game.finalScore to game.finalScore+5
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Good stuff guys ! Got it working after a little faffing around !! The Points all add up correctly now and set as the Best Score if greater at the end of the game.
Last but not least .. sorry! I have tried doing this on my own for the past day or so but for some reason I cannot get the Best Score to save and when you restart the game your best score is displayed.
At the moment Best Score stays the same value as whatever points you have scored for that game.
I have trawled through YouTube video's for examples but no joy getting it working correctly .. something easy I am missing ??
This is what I have done so far ....
I have created an attribute under "Game" for Best Score as an Integer of 0
I have created and added the Actor for (Load Best Score) with the attribute "Load Attribute" on the "initial scene" (Main menu not the game level). The code is shown as From Best Score **Load ** game.bestscore
I've then added within the Main Character/Actor:
If game.score is > game.bestscore
Set game.bestscore to game.score
Save game.bestscore as Best Score
I also have another attribute:
Save game.score as game.bestscore
The Best Score is displayed on the "Game Over" scene.
Have I placed this coding in the wrong place and/or completely wrong ?
Thanks for the supported help!
Rob
Hi,
Would anyone be able to tell me if the above is the correct way to save scores ?
Cheers
Rob
Looks good. You'll need to test it on an actual device to know for sure, though.
The one thing I don't get is why you have this:
If you want to save the game.score attribute in case the game is interrupted, use a key name that isn't the same as an existing attribute (so just call it Score).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Cheers !
Still having problems with this simple piece of coding ??
Tatiang .. Would you mind if I sent you the Project to have a look through to see if I have placed the "Best Score" coding to save it and load into the correct places ?
Ive looked over further tutorials and the advice I've been given already, but for some reason the Best Score is still resetting to 0 when the game is loaded ?
Let us know your email address if your ok to have a look through ?
Thanks
Rob