Log In  
Follow
binaryeye
Follow

I'm having trouble getting rid of a graphical glitch in a game I'm working on.

When the player dies, the game state switches from the main gameplay screen to an intermediate screen that waits for a keypress before returning to the main gameplay screen. If that doesn't make sense, it's similar to Super Mario Bros.; when Mario dies, the main gameplay screen is replaced by a black screen that shows lives remaining, then after a short time returns to the main gameplay screen.

The glitch happens at this return to the main gameplay screen. Before the first frame is drawn, the screen flashes with what appears to be the last frame drawn to the main gameplay screen before it changed to the intermediate screen. Is this the back buffer? It seems like it shouldn't be, because I'm drawing other stuff on the intermediate screen. Is there something else that could be saving the last frame drawn?

I'm running at 60fps and using cls() at the beginning of each _draw() call. The draw operations for each game state are called from within _draw() based on the current game state.

I found the following in the manual: "If your program does not call flip before a frame is up, and a _draw() callback is not in progress, the current contents of the back buffer are copied to screen." Might this have something to do with it?

P#58287 2018-10-23 11:57 ( Edited 2018-10-24 00:47)

To allow more room for maps in my current project, I'm planning to use many of the sprites flipped to achieve more visual variety. While I can easily do this for sprites representing the player or enemies, I'm not sure how to implement it for the maps. I don't believe I can use the map() function, even with the flexibility of its layer flags option. I could of course store a table representing the map, with additional flags to indicate whether or not a cell should be flipped, and draw each individual sprite instead of using map(), but I'm worried this will be too slow and generally cumbersome.

Is there a good way to go about this or am I stuck using no flipped sprites for maps? Or should I instead be looking at ways to compress the map data so I can use more room for sprites?

P#19921 2016-04-19 12:49 ( Edited 2016-04-23 01:26)

Follow Lexaloffle:        
Generated 2021-12-06 17:37:15 | 0.064s | Q:6