center text in pico8 that says "game jam bingo bongo"
- User
center text in pico8 that says "game jam bingo bongo"
- Assistant
To center text in Pico-8, we'll need to calculate the position based on the screen and text widths. Pico-8's default screen resolution is 128x128 pixels, and we typically use the
printfunction to display text.Here's a step-by-step guide to center the text "game jam bingo bongo" horizontally:
-
Calculate the Text Width: Each character in Pico-8's default font is 4 pixels wide (except for spaces and few specific characters like 'i' or 'l' which might be narrower). To find the total width, multiply the number of characters by 4 pixels.
-
- User
it's not quite centered, fix this
- Assistant
I apologize for the oversight. Let's ensure that we precisely calculate the width of the text considering the pixel width of each character. In Pico-8, each character typically takes up 4 pixels, and we should adjust for potentially narrow characters like spaces.
For the string "game jam bingo bongo":
-
The string has 20 characters, including spaces. However, the effective width of a space in Pico-8 is still typically accounted for in spacing the words, so we keep it simple by using a base estimate first, and refine it if needed.
-