Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSamira Tavakolli
6,715 PointsWrapping It Up! problems with adding up scores!
I have trouble with adding up scores after collecting coins .After changing the player to "mikethefrog" and try to add life counter. I simply copied the code lines for adding/removing scores for creating life counter but as the result my player can not add or remove any score. Would some one please help me?
1 Answer
Steven Parker
231,261 PointsThe score is changing, you just don't see it updated on screen. That's because the variable named "text" which gets assigned on line 121 to the game object for displaying the score gets immediately reassigned on line 122 to a different object (the one for life).
One easy fix would be to use a different new variable to hold the object to display life, and also reference it when updating.