Back N Forth (PIXEL Edition) ---------------------------- ZX Spectrum Game for the Crash "TYPE IN" competition (issue 3) Updated and Adapted By Andy Jenkinson (Originally "Back'N'Forth" by QuangDX) Backstory --------- You are a top pilot flying thrill seeking passengers to the edges of the galaxy and back. Your special ThrillSeekerII spaceship has Extreme Turbo Drive (tm) fitted, that always accelerates, with no input from you. All you need to do is apply the retro thrusters [SPACE KEY]. Holding [SPACE] will slow your ship to a standstill, and then reverse it. You CAN tap the retro thrusters to slow the ship - but the passengers won't be that impressed if you saunter up to the edge of the galaxy! They want you to roar up, braking at the very last minute to perform an about turn-right on the edge of the galaxy for the most points! Updates/features ---------------- The BIG change here is the 'pixel' rather than character square positioning of the ship. This isn't normally available using BASIC, but here is achieved using PRE-SHIFTED UDGs. This required re-writing quite a lot of the original, as you can imagine! The idea of holding [SPACE] to slow the ship down, rather than stab at space to change direction alters the game in a subtle way - and enables 'careful' play. It also better resembles a 'proper' physics engine. There's an 'arcade' style "three letter name" high score. Scoring is based on how far away from the edge you are, and how hard (long) you've been braking. Turning around at distance (more than 32 pixels away) scores nothing! Stopping very close to the edge, after hard braking scores much more - but carries far more risk. Animated title screen. Advanced BASIC techniques ------------------------- Due to the size of the ship (two character squares) - there are 3 UDGs required for each of the 8 possible pixel positions within a character square. Given the ship can go in both directions that's 3*8*2 = 48 UDGs ... but the Spectrum only normally has room for 21. By changing the SYSTEM variable at 23675 and 23676 (which points to where the UDGs are poked into memory) I've effectively created 8 'banks' of UDGs depending on whereabouts in a character square the ship is to be printed. This is poked with the correct value, before printing the ship graphic. The large printing on the Title Screen uses the LPRINT command, and changes the system variable (23680,23681) that stores the whereabouts of the Printer buffer to put it within the screen display for this distinctive and speedy effect. The strikethrough Font is achieved using normal printing, then the little used DRAW INVERSE 1; command to remove that line from the screen. The (horrible) mathematics at line 9000 is to preform the pre-shifting of the graphics. This is instead of having a mass of DATA statements with the UDGs already pre-shifted - which would be slightly quicker - but would have meant 384(!) numbers in the data statements at Line 8200 (rather than 16). [Which wouldn't have been ideal for a Type-in!] There's a simple POKE to force caps lock. Optimisation ------------ I've moved BASIC around a to get the main game loop right at the top, and changed some of the way the routines work. RUNning the program will define the UDGs the first time, but will skip this stage when subsequently RUN. I used zmakebas so I could edit on a PC based text editor rather than within the ZX Spectrum basic environment, and I really think this shows just how un-BASIC-like a BASIC game can appear! Andy Jenkinson June '21 andyuglifruit@hotmail.com