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 trial

JavaScript Introducing JavaScript Finishing the Game Wrapping It Up

Thomas Goepfert
seal-mask
.a{fill-rule:evenodd;}techdegree
Thomas Goepfert
Front End Web Development Techdegree Student 6,124 Points

End game

I added a lifecounter to the game and it works great, even has 'you lose' text. But after losing the game my character can still move around and collect coins. How do I make the game stop completely? Here is my workspace-https://teamtreehouse.com/workspaces/40804771

6 Answers

There is a player.destroy() method that causes the player to disappear. I added that after the 'you lose' message is updated, along with changing the background color.

Link gives page not found. Can you update the link?

If you want to share a workspace you will have to create a snapshot. It is the camera icon in the upper right corner.

Hmm... weird. Can you take a snapshot instead? On the top right corner there a camera to take a snapshot of your workspace.

You can place this under both win and lost conditional statements.

player.body.velocity.x = 0;