Ech0_2G Posted September 4, 2015 Share Posted September 4, 2015 I am wanting some text to popup during a collision with an immoveable object in a top down game. I have the collision detection all set up, I can run a console.log of the message I want to display during the collision and it works, however if I try using the following code to display text, nothing happens.var text_options = { font: '32px Arial', fill: '#ffffff', align: 'center'};var text = this.game.add.text(this.game.world.centerX, this.game.world.centerY, sign.message, text_options);text.anchor.set(0.5);You can find the game I'm working on at this link. If you use the arrow keys to walk into the sign (slightly north east from the spawn position) and watch the console you will see the message, but the text refuses to show anywhere. Link to comment Share on other sites More sharing options...
Horizonicblue Posted September 4, 2015 Share Posted September 4, 2015 HiI checked your game link,When you collide into the sign the text appears at the center of your game world.Check it, go left from sign board and straight up after collision. Link to comment Share on other sites More sharing options...
Skeptron Posted September 4, 2015 Share Posted September 4, 2015 I think your problem is that you've centered you text in the world and not in the camera view. As your world is quite big, players have to run a long way before seeing it. Link to comment Share on other sites More sharing options...
demisephi Posted September 4, 2015 Share Posted September 4, 2015 maybe setting position to center on game size not world size and setting text.fixedToCamera = true; will solve the problem ? Link to comment Share on other sites More sharing options...
Ech0_2G Posted September 4, 2015 Author Share Posted September 4, 2015 AHA!!! Well that makes sense. I had tried 10, 10 and 100, 100 for the position to no avail and that makes perfect sense. Thanks guys :/ Link to comment Share on other sites More sharing options...
Recommended Posts