Smoothly Horizontal – Part 4 – Economy of scale

So which is best – storing your graphics already shifted into position, or shifting them in code?  The answer is simple – which you choose is entirely up to you and the kind of game you are writing, there is no ‘best method’ for all cases.

Continue reading

Advertisements

Smoothly Horizontal – Part 3 – Shifting as we go

So pre-shifted graphics are great to use in certain circumstances – objects which are constantly moving horizontally whilst animating, for example (think Manic Miner) – and are fast,  but they also have their drawbacks – not the best use of memory for one.  We could fix the memory issue by not having all those individual graphics, and just shift one copy into the required position when we need to. Continue reading

Smoothly Horizontal – Part 1

Drawing graphics at horizontal pixel, rather than character, positions isn’t quite as straightforward as doing it vertically.  Vertically, as each pixel row has it’s own address on the screen, we just had to find the correct address to start from, and work down from there.  Horizontally however, groups of 8 pixels are held within a single byte, using a single bit each, which makes things more complicated to know which bits to set. Continue reading

Smoothly vertical

Now that we’ve done drawing graphics at character positions, ala BASIC, lets start drawing them at pixel positions – starting with placing them vertically at any pixel row.  This is very similar to the character position code, with a couple of changes…

Firstly we need to make a pixel row address look-up table, which is simply a version of the character table, but for all 192 rows: Continue reading

Once more, with character…

And so we come to drawing graphics on the screen! (‘FINALLY!’, you all cheer)

We’ve now got a simple program where you can move a little coloured block around the screen using the joystick, but wouldn’t it be so much better if it was a smiley face instead?

The pixel display on the Spectrum is a bit… erm… ‘special’, as it’s not arranged in what you’d call a logical way (as we discovered in an earlier post when we filled some of it) and it’s a little complicated to describe, but here goes… Continue reading