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

Yuanjian Liao
Yuanjian Liao
451 Points

Have a hard time display an text object in the game

I am trying to place the life of the character just like the score is places in the game. And I created a text variable that holds the life of the character. But then the life and the score ended up being place the same place in the game. In other words, they are overlapping with each other. is there any way to move down a text object I created used to display the life of the character? Thx.

Steven Parker
Steven Parker
231,269 Points

To facilitate analysis, make a snapshot of your workspace and post the link to it here.

1 Answer

Steven Parker
Steven Parker
231,269 Points

Without seeing your code, this is a bit of a guess, but to create the additional object I would expect you would use a call to the game.add.text method. This first two arguments passed to this method are the coordinates on the screen where the object will be placed.

So it sounds like you may have placed the new item at the same location as the score ("text"). But if you give it sufficiently different coordinates it should not overlap.

Yuanjian Liao
Yuanjian Liao
451 Points

I fixed it. I was being stupid. I forgot to change the coordinate of the text object when I was creating it. Thanks a lot.