Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing an updated screenful in one go
Hello everyone,

I'm loving the discovery of zxbc and having a great time working on the game I always wanted to make! Thanks Boriel!

I've written code that randomly generates a map (well, its floor), which is stored in an array. To keep the size in memory down, I store the rows as bits and have written a routine to make reading this back in the game code nice and simple. I can easily determine if any given coordinate is floor or not. I'm really happy with this. Bit operators are brilliant!

I'm now at the stage where I need to start putting my graphics on the screen. Using the map floor as a reference, I intend to display the walls and floor of the dungeon using 3x3 character blocks, with each successive row overprinting the bottom of the row before it. This way I should be able to display a 9 x 9 view with a pseudo 3D view and the player in the middle.

Using the floor as the starting point, what's I'm trying to work out right now is the best way to could assemble the whole view of this and print it to the screen in one go so the player doesn't see it redraw tile by tile. As the game is turn based, I don't mind if preparing and moving the updated screen isn't instant.

I've thought of two methods:
  1. Dynamically create a string and colour it in using control codes, to set everything up that is then printed in one go.
  2. Scroll the screen, a tile in whatever direction needed and then fill in the space.
I think the first would give the best results, if it's possible, and the second should be achievable with the scroll routines I've been reading about.

My questions are whether there are any other approaches I could take and if anyone kindly has any advice on manipulating and embedding control chars into strings. I've read some other posts but these don't go as far as constructing a string.



I'm probably going to keep throwing my thoughts into this thread (sorry - I do this on car forums when I'm fixing my old car!).

If I'm treating the string as a fake screen, could I use chr$ 22 as if it were AT? Does the string reorder itself if I do something like

LET s$ = s$ + chr$(22, y, x, 17, 1, 65)

And replace the 1 and the 65 with values from an array that stores the colour swatch and characters?

I'm then curious how the string is stored. Is it the logical concatenation of all of the statements like the above that I'll loop through 81 times or does it reorder itself if the AT equivalents were presented in a non-linear fashion?

Messages In This Thread
Printing an updated screenful in one go - by worcestersource - 01-11-2021, 09:09 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)