I’m building a NES Mario clone as a first exercise to get to know Phaser 3.
I’m using a 16x16 tile map. I want the game to scale with the screen size, since a 16x16-based world is tiny, So I added a scale property to the config object:
I gave the parent container (‘game_container’) a max width of 800px.
I added a score text in the corner of the screen - at the original size (350px width), text looks good.
The problem: at 800px width, it looks blurry:
Is there anything I can do to make the text stay crisp even on scaling?
or would I have to rebuild everything with bigger tiles and give up on scaling?
You have a couple of different options here. I would probably reccomend 1 as its the easiest (IMO):
Create the text into another scene, and have its own class handle all of it’s state. This will not scale if you apply scaling to the parent (or main game) scene. But given you’re code, you’re trying to scale the entire game with parent game_container. I do most of my scaling in a “main scene” and the other scenes all remain unscaled.
Use a bitmap text and apply scaling to that. This is better for performance than option 2, but I’ve never personally done it and imagine it probably is a PITA.
I see you don’t actually define scaling in the init config just centering? Are you using something like:
scale: { mode: Phaser.Scale.ScaleModes.FIT } ?
Another option for retro type game that looks great is using retrofonts which are monospace tileset type picture fonts. They seem to scale pretty well. Anyway with FIT scaling normal fonts work pretty well aswell.
Hello @udidol, i know you figure this out but if you have time, can you please share your index.html, i had something similar like this and i figure that on index.html’s css i have some rendering code which makes all game blurry. After deleting those, it was done
Hey @udidol, i have this pixel problem because of the
this actually made my game pixelated. My canvas area is 1920x1080 and it was getting pixel’s when i small the canvas size e.g when i gave mode: Phaser.Scale.WIDTH_CONTROLS_HEIGHT to my scale object inside config
Maybe you could also try to get ride of those
Update:
Hey again, I told that I gave mode: Phaser.Scale.WIDTH_CONTROLS_HEIGHT but i have changed my config like this: