-->

FUZE BASIC Examples – Part 2

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
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.

FUZE BASIC Examples
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.

FUZE BASIC Examples
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.

FUZE BASIC Examples
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:

  1. CLS
  2. FOR size = 1 TO 7 LOOP
  3. INK = RND(30)
  4. FONTSIZE( size )
  5. PRINT “Hello”
  6. REPEAT
  7. 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:

  1. CLS
  2. LOOP
  3. PRINT “Sense Accelerometer X=”; SENSEACCELX
  4. PRINT “Sense Accelerometer Y=”; SENSEACCELY
  5. PRINT “Sense Accelerometer Z=”; SENSEACCELZ
  6. REPEAT
  7. END

RPI Sensehat


HAT COMPASS

And this code will return the value of the SenseHAT’s compass:

  1. CLS
  2. LOOP
  3. PRINT “Sense Compass X=”; SENSECOMPASSX
  4. PRINT “Sense Compass Y=”; SENSECOMPASSY
  5. PRINT “Sense Compass Z=”; SENSECOMPASSZ
  6. REPEAT
  7. END

FUZE BASIC Examples
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.


FUZE BASIC Examples
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.


FUZE BASIC Examples
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.


FUZE BASIC Examples
Reaction timer


0 Response to "FUZE BASIC Examples – Part 2"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel