Nicholas Darwin bounces on to your screen with an unusual arcade game
Bertie Bounce is a bright sky blue rubber ball and unfortunately he has become lost. In this vertically scrolling arcade game - a rarity on the Electron - your task is to guide him back home.
The path you take is made up of small blocks, some of which can be rolled over while others must be bounced over as they will destroy Bertie. You may find that rolling on to one type of block makes Bertie stick to the spot, while another makes him bounce high into the air. Some make him appear to be drunk and you lose control of his actions for a few seconds.
The program is written in Basic, but despite this it runs extremely quickly - you won't need your Turbo switched on for this game. In fact, an extra line has been added to slow down the frantic action:
320 FOR DELAY=1 TO 200:NEXT
If you still find the game too difficult, increase the delay loop to 300 or 400. If it is too easy, reduce it to 100 or 50.
Z - Left, X - Right, SPACE - Bounce
John Geraghty offers an impressive graphic demonstration of the Electron's capabilities
We have seen many graphic demonstrations over the past seven years at Electron User, but none have impressed us so much as this amazing sunburst display. The speed, colours and effects are stunning and superbly show off the micro's power.
It is said that the simplest ideas are often best, and when it comes to producing fascinating displays on your micro there is none simpler or better than the Roses algorithn. To see an example of this, enter and run the program SUNBURST1.
All this program does is accept an input of an angle, and repeatedly turning through this angle, draws about a central point. However, note what happens if you enter a number which is an exact divisor of 260 - you get a regular polygon. Otherwise the design goes around several times before returning to the initial point. Try entering 222 and see what happens!
The trick of the Roses algorithm is simply to make the radius, R%, of the design a variable rather than a constant. Enter the following lines, then enter 222 for the degree increment:
45 INPUT "Radius factor";n%
300 DEF FNr
310 =500*COS RAD(deg%*n%)
Try different values and see what happens.
This is the basic algorithm. It can be taken further by adding colour and using triangle plotting to produce a solid design. Enter these lines and again try 222 and 6 when prompted:
101 MOVE FNx,FNy
256 GCOL 3,R% MOD7 +1
260 PLOT 85,FNx,FNy
This is the type of pattern produced by the second program, SUNBURST2. In addition, there are several machine code routines to overlay stippled colours, change the palette and scroll the screen, giving a constantly changing display.
SUNBURST2 features a cycle of six patterns, each lasting several minutes. The data - degree increment and radius factor - for each pattern is held in pairs in a data statement at the end of the listing. You may be able to find additional values and incorporate them - just make sure the data ends with the dummy values 999,999.
The high resolution display and large array consume a lot of memory, so there aren't any REM statements in the program. Here is the outline:
PROCtitle: Draws the title screen mask in colour eight, which is invisible because the flashing colours have been turned off by *FX9. When the pattern is drawn by PROCpattern, everything inside the mask is in colours 8 to 15 and everything outside is in colours 0 to 7. The pattern is EORed on to the screen and, because colours 0 to 7 have been defined as background only, the masked area can be seen. Later, colours 0 to 7 are redefined to show the whole screen.
PROCinit: Sets up the variables, assembles the machine code and works out the VDU codes for the first pattern using FNpoint. This function returns TRUE when the data set is complete. While this is going on the machine code routine Rnd-col clears the screen in a random way.
FNpoint: Works out the colour and the coordinates of the next point. The Basic SIN and COS functions aren't used as it is quicker to work them out from the previous values.
PROCfx: Calls PROCpat_init to reset the variables for the next pattern. The data for the new pattern is calculated in the time interval caused by the delay. It also switches the colour palette according to whether the title screen is showing or not. This is determined by the flag title%. Finally, it can apply an overlay of stippled colours in various ways.
Feel free to experiment with the pattern data at the end of the listing - there are many more interesting and colourful patterns just waiting to be discovered.