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
170,315 Points

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

1 Answer

Steven Parker
Steven Parker
170,315 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.