keyboard keys

Discussions related to graphics (2D and 3D), animation and games programming
stevewilson
Posts: 5
Joined: Sat 09 Mar 2024, 19:30

Re: keyboard keys

Post by stevewilson »

HI,

Thanks nvingo. Very helpful. I am gradually making sense of what I have to do!

Jeremy. I think I looked at the Aliens example programme, but will take another look.

Steve W
User avatar
JeremyNicoll
Posts: 72
Joined: Sun 26 Jul 2020, 22:22
Location: Edinburgh

Re: keyboard keys

Post by JeremyNicoll »

stevewilson wrote: Sun 07 Apr 2024, 17:31 Jeremy. I think I looked at the Aliens example programme, but will take another look.
It's not the overall graphic techniques used there that I'm highlighting - which may or may not apply to you - simply that rather than removing a character from somewhere (so having to restore what was previously underneath it) & putting it somewhere else could be difficult to achieve, but recreating the whole display from scratch without that character is in fact feasible.

Graphics / games libraries which support things like moving avatar images around a playing area, detecting collisions between them etc probably provide a way to remove any part of an image ... but there's no point in suggesting you use such facilities unless you actually need them. I assume they work by maintaining an internal list of which images overlap which others & always know what images are under other ones - just as in the OS the system knows which windows overlap others so can either immediately redraw part of something when a window that obscured it is moved aside, or can ask the application(s) responsoble for the underlying contents that have just been made visible again to be redrawn.

Think how much more complicated ALIENS.BBC would be if the programmer had to keep track, for every displayed pixel, whether it was just background or an alien, or another aline partly blocking the first one, or another part;y blocking the second ... and so on. In that situation replotting the whole display - first background then successive aliens (so that those that do overlap others are drawn after the earlier ones are drawn) is MUCH simpler.