Continuing from the previous pages, here are ten more excellent examples of what can be done with FUZE BASIC. Take what you want from the code, alter it and insert it into your own routines to fine-tune your program.
AMIGA BALL
Amiga owners will have fond memories of their futuristic computer back in the late ‘80s and early ‘90s. The Amiga was a pretty impressive home computer, even by today’s standards and its iconic Bouncing Ball routine will forever be remembered by those who grew up with one. Load up aball.fuze from Demos and see what you can use.
|
FUZE BASIC Examples |
ANALOGUE CLOCK
Whilst an analogue clock on the screen, complete with second hand, may not sound too interesting, there’s a surprising amount of useful code within this particular routine. Clock.fuze is in the Demos folder and once loaded up you can strip all manner of handy code snippets from it.
|
ANALOGUE CLOCK |
KEYBOARD INPUT
Scankeyboard.fuze is an extremely handy bit of code to load up. It’s a simple program that will display the key pressed on the keyboard, which is a great resource when it comes to creating keyboard interactions with the user and the program, such as a game. Just take the key codes you need and insert them in your own programs.
|
Keyboard input |
BBC MICRO::BIT
This code snippet will look for and detect any attached BBC micro:bit or Arduino compatible devices that you’ve attached to the FUZE IO or Raspberry Pi GPIO pins. It’s incredibly handy for helping you create the code behind your hardware project.
|
BBC MICRO::BIT |
FONTS
This little snippet of code, although simple, will display some of the available font sizes of FUZE BASIC. The maximum size is 20, so alter as you wish:
CLS
FOR size = 1 TO 7 LOOP
INK = RND(30)
FONTSIZE( size )
PRINT “Hello”
REPEAT
END
|
Fonts |
RPI SENSEHAT
If you’re working with a Raspberry Pi SenseHAT, then the following code will return the current value of the HAT’s accelerometer:
CLS
LOOP
PRINT “Sense Accelerometer X=”; SENSEACCELX
PRINT “Sense Accelerometer Y=”; SENSEACCELY
PRINT “Sense Accelerometer Z=”; SENSEACCELZ
REPEAT
END
|
RPI Sensehat |
HAT COMPASS
And this code will return the value of the SenseHAT’s compass:
CLS
LOOP
PRINT “Sense Compass X=”; SENSECOMPASSX
PRINT “Sense Compass Y=”; SENSECOMPASSY
PRINT “Sense Compass Z=”; SENSECOMPASSZ
REPEAT
END
|
Hat compass |
MOUSE CONTROL
If you want to incorporate mouse pointer and button use in your code, then this will certainly help you out. It’s a fairly simple bit of code but remarkably effective and it can easily be inserted into your own programs.
|
Mouse control |
JOYSTICK CONTROL
Including the use of a gamepad or joystick in your games or code is a great addition to also being able to redefine the keyboard. This code will detect and display the states of each of the axis and buttons.
|
Joystick control |
REACTION TIMER
Finally, if you’re after something a little competitive with your family, then load up reaction.fuze from the Demos folder. When run, this code will test your reaction time by hitting the Spacebar when indicated. See how fast you can get it, and see if you can hack the code.
|
Reaction timer |
0 Response to "FUZE BASIC Examples – Part 2"
Post a Comment