Hi. I am testing a vertical scrolling algorithm, but I get some flicker when I try to update both pattern and name tables at the same frame on each 8th frame. This roughly is what I am trying to do:
#include <stdint.h> #include <stdbool.h> extern const uint8_t map_data[MAP_WIDTH*MAP_HEIGHT]; uint8_t *map_data_p = map_data; void run_loop() { int8_t frame = -1; bool game_running = true; while (game_running) { frame++; update_tiles(); // move the maze up pixel by pixel by changing the pattern table if (frame == 7) { frame = -1; // reset frame counter map_data_p += 32; // update map pointer by width size (point to the next line) update_map(); // move the maze up tile by tile by changing the name table } // process user input and update sprites // ... wait(); // wait the allotted frame time to finish }
Has anyone implemented this type of scrolling engine successfully without flicker?
Для того, чтобы оставить комментарий, необходимо регистрация или !login