displaying text problem

HI,

I can’t get this code to display the text object but all the other objects display fine. I’ve looked at my syntaxe and all but didn’t find my mistakes.

Here’s the text, it’s not the full code it’s only that one function. If you think it has to do with the whole code tell me and i’ll post the whole code.

function addGameScreen()
    background = display.newImage(“bg.png”, 0, 0, true)
    background.x = _W
    background.y = _H

    paddle = display.newImage(“paddle.png”)
    paddle.x = 240
    paddle.y = 300
    paddle.name = “paddle”

    ball = display.newImage(“ball.png”)
    ball.x = 240
    ball.y = 290
    ball.name = “ball”

    scoreText = display.newText(“Score :”, 5, 2, “Arial”, 14)
    scoreText:setFillColor(1, 1, 1)
end

It’s the score text object that doesn’t work.

Hi @leonardmeard,

This may be an issue with the font (unlikely, but possible). For testing, in place of “Arial”, please put:

[lua]

native.systemFont

[/lua]

Then, make sure that the text object isn’t somehow being placed off screen. For testing, place it in the center of the screen:

[lua]

scoreText = display.newText(“Score :”, display.contentCenterX, display.contentCenterY, native.systemFont, 14)

[/lua]

If neither of these work, there may be another issue we need to diagnose.

Best regards,

Brent

Hi @leonardmeard,

This may be an issue with the font (unlikely, but possible). For testing, in place of “Arial”, please put:

[lua]

native.systemFont

[/lua]

Then, make sure that the text object isn’t somehow being placed off screen. For testing, place it in the center of the screen:

[lua]

scoreText = display.newText(“Score :”, display.contentCenterX, display.contentCenterY, native.systemFont, 14)

[/lua]

If neither of these work, there may be another issue we need to diagnose.

Best regards,

Brent