Discord
Login
Community
DARK THEME

Single Font Overlapping

Hello, I've been having troubles with changing the fonts in my game.
I've seen one post about this problem on the forums, but it only referenced the documentation:

if screen.isFontReady() then

//we can use the default font

screen.drawText("MY TEXT",0,0,50)

end

screen.loadFont("DigitalDisco") // make sure DigitalDisco will be loaded

if screen.isFontReady("DigitalDisco")

screen.setFont("DigitalDisco")

screen.drawText("SOME OTHER TEXT",0,50,20)

end


I've tried to follow the documentation, but I don't know where it suggests implementing it. I also tried another method with more success, but it overlays fonts instead of changing them:
init = function()
end

update = function()
end

draw = function()
screen.setFont("GrapeSoda")
screen.drawText("Enemy 1",144,89,10,"rgb(255,255,255)")
end

V.S.

init = function()
end

update = function()
end

draw = function()
screen.drawText("Enemy 1",144,89,10,"rgb(255,255,255)")
end



With this, I keep seeing an overlay with one font on top of another. It goes away in about 30s after the game initializes. Is there any way to create a font for a specific portion of the text in the code without it creating two instances of the text? Let me know if this makes sense.
init = function()
  font = fonts[ random.nextInt( fonts.length )]
  screen.loadFont(font)
  while not screen.isFontReady(font) print("load..") end
end

update = function()
end

draw = function()
  screen.clear()
  if screen.isFontReady(font) then 
    screen.setFont( font )
    screen.drawText( system.time(), 0, 0, 20,"red")
  end
end

https://microstudio.dev/i/gilles/fonts/

Search public projects for "font" .

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community