Slow slow quick quick slow…

Most of the questions I get asked about writing games for the Spectrum are about graphics – so the next two posts will cover two such questions on that topic.  The first question regards how to move objects around the screen at rates other than multiples of a pixel, such as moving 2 pixels every 3 frames.

If we were writing our game using a modern language on a modern system, this wouldn’t even be a problem – the position of the object would be stored using floating-point numbers, which we could adjust however we like safe in the knowledge that the system will render our object at exactly the right place – easy.  But we’re not a modern language or system, and on the face of it can’t do either of those things – we don’t have any floating-point registers, and have to sort out the actual rendering ourselves – but it can still be done.

Continue reading

Advertisements

Rear Gunner XL – Part 4 – Movement

So far we’ve setup the variables we need, and drawn our sights and the enemy into the screen.  We still can’t really play the game though, as we need to have some way of moving around,  This is handled in lines 90 to 140:

; 90 IF INKEY$=“5” THEN LET B=B-1
; 100 IF INKEY$=“8” THEN LET B=B+1
; 110 IF INKEY$=“7” THEN LET A=A-1
; 120 IF INKEY$=“6” THEN LET A=A+1
; 130 IF INKEY$=“0” THEN GOTO 150
; 140 GOTO 50

Continue reading

Racing (and other games) at Kempston

In most games, you’ll need to provide joystick control.  The Spectrum has quite a few different types of joystick interface – Protek/Cursor, Sinclair Interface 2, and Kempston – with Kempston being the most popular.  The Kempston interface is also special as it’s the only one of those which isn’t actually keyboard-based, and so is logically separate from controlling a game via keyboard.  It’s also pretty easy to use to! Continue reading