Super short game made for TriJam - an endless shooter in which you have to dodge a lot of asteroids with a spaceship with inertial dynamics!
Ah, noticed that @dw817. I'll have to take a look. I think it appeared when I added a line to delete meteors once they're off-screen, but I'm not sure what one thing has to do with the other since the drawing code should be unchanged.
I think I've figured out what is going on. Moving the del line to its own loop in _update() fixes the issue. First I tried moving it into the loop already in _update(), but that caused the meteors to freeze for a frame instead of flicker.
What I think is happening is that del shifts the table's contents around to fill the gap left by what is deleted (the docs say this happens). This causes the next meteor to get skipped by whatever loop the del is in, because the next meteor fills the spot of the meteor that was removed.
If you watch closely, the meteor that flickers is the furthest down one right after one passes out of view.
@Shoxidizer I guessed it could be something like that, thanks! I'm new to Pico-8, this was my first game with it so I didn't know about these quirks.
@dw817 thanks, though the lack of brakes and completely inertial maneuvering was intentional :D. How did you fix the flickering? My first guess would be, store in a table the meteors to delete, then delete them all in a second loop, but maybe there's a different trick?
Well now I don't know if I got rid of the flicker completely, Gan. I added a seldom-known command of:
It keeps the screen as it is now before the flicker - if it's hardware flicker that is, too many elements moving on the screen.
To remove flicker completely you should not be erasing the asteroids as they move (if that's what you're doing).
Instead use CLS() at the beginning of draw(). Then draw everything, make sure you have it all drawn at the end of the DRAW() command, it will appear correctly then no matter how many elements you have, and you should be good to go.
Redrawing the screen each time with no manual erasing of your plotting is truly the best way to go for a large number of elements on the screen.
No, I do already use CLS(), not to mention I draw the whole background every time so that would overwrite everything anyway. I think the cause of the flicker is the fact that as discussed above I delete the meteors in the same loop as the one in which they are drawn. If instead I stored them to be deleted later it would probably work out. I'll have to try as soon as I have time to.
EDIT: fixed I think!
[Please log in to post a comment]