Log In  

Cart [#nevertell_odds-2#] | Code | 2019-10-14 | License: CC4-BY-NC-SA | Embed

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!

P#68830 2019-10-13 13:35 ( Edited 2019-10-14 17:35)

:: dw817

Getting some flicker in the asteroids and their trails, @Gan_HOPE326. Let me first off see if you can fix it. If not I'll give you one solution I would use as code.

P#68836 2019-10-13 16:05 ( Edited 2019-10-13 16:06)

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.

P#68837 2019-10-13 16:14 ( Edited 2019-10-13 16:15)
1

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.

P#68844 2019-10-13 19:51
:: dw817
1

Here, I changed it up a bit. Bumped you up to 60fps and gave your ship some air-brakes.

See if it helps:

Cart [#nobinobesu-0#] | Code | 2019-10-13 | No License | Embed
1

P#68845 2019-10-13 20:36 ( Edited 2019-10-13 22:59)

@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?

P#68852 2019-10-13 22:48
:: dw817

Well now I don't know if I got rid of the flicker completely, Gan. I added a seldom-known command of:

holdframe()

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.

P#68853 2019-10-13 23:02

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!

P#68868 2019-10-14 10:22 ( Edited 2019-10-14 17:36)
:: dw817

Yep, I think you got it. Consider running your game at 60fps for smoother motion.

P#68877 2019-10-14 17:40

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-11-19 00:25 | 0.069s | 4194k | Q:53