According to the manual
> Additionally, when X, Y are not specified, printing text below 122 causes the console to scroll. This can be disabled during runtime with POKE(0x5f36,0x40).
However I've got a cart that has a performance issue as soon as the print leaves the screen.
poke(0x5f36,0x40) to the cart fixes the issue so the performance issue is to do with screen scrolling.
To see in the above cart press X to start the game and wait for the ship to leave the bottom of the screen
The screen scrolling / performance issue is coming from:
function _update60() print(state) print(state.update)
print() always modifies the cursor position, so once your enemy's y-position is >= 122, so is the cursor. This is why setting
poke(0x5f36,0x40) fixes the issue, since no x/y args are passed to those calls (which causes the cursor to scroll).
You never see it while the program is running is because it happens in-between the last time the framebuffer was flipped to the screen (automatically by Pico-8 at the end of
_draw()) and when you cleared the framebuffer by calling
cls(). If you stop the program by pressing
ESC to enter the console, you can catch it in the act:
If you need debug info from your update funcs, try launching Pico-8 from a terminal and using printh to print to the host console instead.
Hope that helps! :)
I'll second @ridgekuhn suggestion of the printh() for debugging...it helps a ton to the point where I now rely on it. Printing on the game screen is helpful for loop-type things but the terminal debug is far more valuable and you can put printh() all over the place without worry - just remove them when you're all done :)
I recently realized I can launch PICO-8 from the terminal in VSCode and have it in a sidebar. Files/functions on the left, code in the middle, terminal for debugging on the right. It's made a huge difference for the sanity of my coding.
But even if you're not using an external IDE and use your regular OS terminal, it'll keep things better organized. That's how I did it for a long time until I started in the IDE terminal.
[Please log in to post a comment]