BBC BASIC for Windows
Programming >> Graphics and Games >> Sprites and Refresh
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1386770314

Sprites and Refresh
Post by KenDown on Nov 24th, 2013, 5:37pm

I have adapted a neat little program from the Acorn days which produces one of those scrolling day and night displays which overlays the pattern of night (and, obviously day) on a map of the world. It works very nicely and as I am using to demonstrate a concept, day and night move in response to cursor keys rather than the clock.
Fine. Everything is rock steady, because I am using *REFRESH OFF and a *REFRESH after drawing the new pattern.
However the sun is indicated with GCOL3,whatever, which means that its colour varies as it passes over land or sea. I thought it would be a nice idea to use a sprite for the sun. Fine, everything works - except that now the shadow of night and the text on the screen flickers horribly.
Remove the references to sprites and back to rock steady. Initialise sprites and flicker.
Am I doing something wrong or is this an undocumented feature of the sprite library?
Re: Sprites and Refresh
Post by admin on Nov 24th, 2013, 6:38pm

on Nov 24th, 2013, 5:37pm, KenDown wrote:
Am I doing something wrong or is this an undocumented feature of the sprite library?

I don't think you can mix the use of sprites with *REFRESH, as these are alternative ways of making animation 'glitch free'. I would recommend that you choose one or other technique, and then stick with it for the entire program.

For example if you use *REFRESH don't you need to redraw the background each time the sun moves anyway? Even if you don't need to redraw the entire background you could save and then restore just the bit covered by the sun (e.g. using *GSAVE/*DISPLAY or RECTANGLE .. TO).

Richard.