GB
  
You are currently viewing the United Kingdom version of the site.
Would you like to switch to your local site?
15 MIN READ TIME
B2

Coding a BBC Basic Space Invader clone

Nate Drake invites you to stave off the alien menace by coding your very own Space Invaders clone in Basic, because it’s 2025!

Part Two ! Don’t miss next issue, subscribe on page 16!

Part Two !Don’t miss next issue, subscribe on page 16!

OUR EXPERT

Nate Drake is a tech journalist specialising in cybersecurity and retro gaming. His first experience of video games was the ‘cocktail cabinet’ version of Space Invaders in his father’s local.

In the first part of this series, we introduced Basic and discovered how it’s ideal for learning I programming by creating simple games like Mark Buckwell’sCosmic Invaders.

If you went through the code in the article and used the sample scripts available from https://github.com/azuregate/lxfcosmicinvaders/, you’ll now have a game with a colourful title screen that plays a brief tune, then invites players to press Space to start or Q to quit. This month, we’ll focus on loading the game variables, as well as the basic elements of the main screen, such as the scores, aliens and player base.

We’re using the mighty b2 BBC Micro emulator. There’s a Snap version in the Ubuntu Software Center, making it easy to install. The code in this series works in other emulators; if possible, set your program to emulate a BBC Micro B 1770 as we’ve done, or it may render graphics differently from what you see here.

Game setup

If you ran the most recent sample script, COSMIC4. BAS, you’ll have seen that when the player presses the space bar to start a game, all that happens is a message to this effect.

In the original game script, this indirectly launches the procedure PROCSetup_Game. You can read through lines 2230-2280 to find out what this does.

As you’ll see, line 2240 reads CLS . This is shorthand to clear the screen of any existing text.

The next two lines define variables like the number of bombs and missiles. At the end of line 2260, you’ll notice our old friend, the VDU command:

VDU 23,1,0;0;0;0;

This command is quite common in video games, because it hides the cursor. Players can do without the distraction, particularly if they accidentally hit the wrong key so that text appears.

Unlock this article and much more with
You can enjoy:
Enjoy this edition in full
Instant access to 600+ titles
Thousands of back issues
No contract or commitment
Try for 99p
SUBSCRIBE NOW
30 day trial, then just £9.99 / month. Cancel anytime. New subscribers only.


Learn more
Pocketmags Plus
Pocketmags Plus

This article is from...


View Issues
Linux Format
March 2025
VIEW IN STORE

Other Articles in this Issue


LINUX FORMAT
LINUX FORMAT
Future Publishing Limited, Quay House, The Ambury, Bath,
WELCOME
LINUX FORMAT
MEET THE TEAM
Steaming hot!
I’ve always said – not that anyone really
REGULARS AT A GLANCE
SteamOS rolls out to third-party devices
OPERATING SYSTEM
FOSS funding insights
Organisations currently invest $7.7 billion annually into open source development.
New Nvidia Linux AI hardware
Project Digits is world’s smallest AI supercomputer.
OFFICE SPACE
OPINION
SIX DEGREES
OPINION
RISC-Vtaking off
As RISC-V performance increases, will there be wider adoption in 2025?
Something for the weekend?
Ubuntu proposes extending its no-weekend SRU policy.
Stack Overflow survey in
The numbers reveal Linux as the most popular developer OS.
Distro watch
What’s behind the free software sofa?
VULKAN IS READY
OPINION
WINED & REFINED
OPINION
Kernel Watch
Jon Masters summarises the latest happenings in the Linux kernel, so that you don’t have to.
Answers
Got a burning question about open source or the kernel? Whatever your level, email it to answers@linuxformat.com
Mailserver
Riding the retro Noting the continued interest in
Helpdex
shane_collinge@yahoo.com
YOUR DIGITAL ISSUE ACCESS
Linux Format print subscribers can now access digital back issues two ways! * Who’s a lucky bunch of readers?!
HandBrake
Version: 1.9.0 Web: https://handbrake.fr Unlike audio files,
Universal Media Server
Version: 14.8.0 Web: www.universalmediaserver.com You can use
Fooyin
Fooyin ships with a handful of layouts and
Cryptomator
You can create multiple vaults with Cryptomator. Each
Syncthing
Version: 1.21.1 Web: https://syncthing.net Syncthing offers very
OpenBoard
Version: 1.7.2 Web: https://openboard.ch/index.en.html OpenBoard works best
TurboVNC
Version: 3.1.3 Web: www.turbovnc.org TurboVNC’s developers claim
Extreme Tux Racer
Version: 0.8.4 Web: https://extremetuxracer.sourceforge.io/ Like the original,
Luanti
Version: 5.10.0 Web: www.luanti.org As well as
KStars
Version: 3.7.3 Web: https://apps.kde.org/kstars You can use
ReMove to Waste
Version: 0.9.3 Web: https://github.com/theimpossibleastronaut/rmw The ReMove to
HACKING ACADEMY!
Can you pass? Get up to speed on the hacking world with the tools and tricks to sneak around networks!
REVIEWS
Intel Arc B580
Donning our flowing cape and pointy hat, Linux Format is Battlemage!
Manjaro 24.2.1
Nate Drake delves into the distro that claims to make Arch Linux easy – will it puts its money where its mouth is?
Archman 2024-12
Nate Drake takes this Turkish Arch-based distro for a test spin. Is it as lightweight and stable as it claims?
OpenMandriva Lx 24.12
Nate Drake explores the rolling release of this Mandriva-derived distro. Is it a worthy successor or just another frivolous fork?
Window Maker Live 12
Nate Drake revisits the glory days of Linux before we had those newfangled desktops – is Window Maker all you need?
Caves of Qud
The Management demands to know why we can’t randomly generate all magazine content. Jonathan Bolding hates to disappoint.
Screen recorders
Whether it’s for recording your gaming or for desktop application tutorials, Michael Reed looks at five apps that can record screen activity.
Installation and initial setup
A good range of suitable installation options is always welcomed.
Suitability for casual users
Which option is best for people who just want to start making videos?
ROUNDUP
Main recording user interface
One of the most important areas.
Documentation and support
How to use the software and get out of difficulties
Routing and codec options
Routing flexibility and codec settings.
Extra features
Beyond simply recording videos of the screen, what can it do?
Configuration interface
Finding settings, understanding them and changing them.
The verdict
Screen recorders
FIREWALL YOUR HOME
FIRE WALL YOUR HOME
Keep out the net nasties and track what comes in and goes out of your home network with vital help from Matthew Holder .
The network basics
Before we get into the nitty-gritty, let’s introduce a few concepts…
Fire up your router
You don’t have to stick with your router’s proprietary firmware…
Remote access
Discover how to access your home network from elsewhere.
Filter your traffic
You don’t want everybody to be able to access everything…
Separate functions
Set up a spare Raspberry Pi as a separate Wi-Fi SSID.
Pi USER
Hacker claims RP2350 challenge bounty
Engineer Aedan Cullen cracks OTP secrets through glitching RISC-V cores.
Pi hits 16!
Gigs of memory, that is…
Mecha Comet
Pi-compatible gadget.
FRESH FRUIT FOR PI FANS
Les Pounder works with groups such as the
Raspberry Pi Connect
Les Pounder dreams of working from a hot beach, but fears sand may break his Raspberry Pi. Perhaps Raspberry Pi Connect is the answer?
Touch Display 2
Les Pounder’s life flashes before his eyes as he realises it’s been nine years since the first Pi display arrived.
Formlabs Form 4
Perfect prints are as easy as a game of connect the dots for Denise Bertacchi.
Raspberry Pi SSD
Yet another official Pi accessory arrives in the Linux Format office, shortly followed by Les Pounder coming to sing its praises!
Build a camera trap with the BlueSky API
PI CAMERA
Take Pi control of your model trains
JMRI
TUTORIALS
Terminal RPGing
Shashank Sharma has been informed that an elf, an orc and a hobbit walking into a bar is not a bad joke but a common occurrence in RPGs.
Store passwords securely on your PC
KEEPA SSXC
Expand your use of open mapping
Marco Fioretti concludes his tour of the OpenStreetMap world, showing how vast and open to everybody it is.
Discover next-gen Auracast audio
Part of Bluetooth Low Energy, Auracast is ready to revolutionise the world of Bluetooth audio and Tam Hanna can finally give up his Palm OS device.
Revisit the past with punch cards and tape
Relive the world of data entry by punching holes in paper or some leftover Christmas cards with the ever-so-retro Mike Bedford
Upgrade it: Get a faster Wi-Fi router
It’s been a long time since 802.11n was released and a lot has happened since then – Neil Mohr has started to go grey for starters.
Asus ZenWiFi AX (XT8)
Overall the best router money can buy.
Nighthawk RS300
All the Wi-Fi 7 tech, without some of the cost!
Google Nest WiFi Pro
If you like your routers egg-shaped, Google’s got your back.
Linksys Hydra Pro 6
The best Wi-Fi 6 router for most people.
Netgear Nighthawk RAXE300
A more affordable mechanical model.
Devolo Magic 2 WiFi 6 Mesh
If your home needs special solutions for thick walls.
Asus ZenWiFi Pro ET12
We want Wi-Fi, not a family holiday in Spain!
Netgear Orbi Quad-Band WiFi 6E
We want Wi-Fi, not a Caribbean holiday!
ADMINISTERIA
Create quick, simple repeatable playbooks
Everyone likes to say that Stuart Burns is an Ansible man and that’s nothing to do with his faster-than-light communication.
PASSWORD PRACTICALITIES
Stuart Burns is a sysadmin for a Fortune
Intel’s Battlemage
Finally a champion for the budget gamer, Intel’s new Arc series offers memory, speed, quality and machine learning for less, Jarred Walton discovers.
CODING ACADEMY
Rust: How to start coding your first apps
David Bolton introduces Rust programming by setting it up then running and debugging a program to analyse text.
ADVERTISEMENT
THE BRAIN TUMOUR CHARITY
thebraintumourcharity.org
Techradar
WWW.techradar.com
MAGAZINES DIRECT
www.magazinesdirect.com
MAGAZINES DIRECT
www.magazinesdirect.com
LINUX FORMAT
magazinesdirect.com
CODECLUB
www.codeclub.org.uk
EFF
EFF.ORG
GO COMPARE
MAGAZINES DIRECT
www.magazinesdirect.com/LIN/DH43Z
Chat
X
Pocketmags Support