Most of the ones visiting here might have made projects using arduino, but very few know how to use it for gaming purpose. This instructable will guide you from scratch on how to make a video game which can be controlled using an Arduino.
This instructable will open new applications of using an Arduino and make your projects better than before.
Step 1: Installing Scratch for Arduino
Please visit the site http://s4a.cat/
S4A is a Scratch modification that allows for simple programming of the Arduino open source hardware platform. It provides new blocks for managing sensors and actuators connected to Arduino. There is also a sensors report board similar to the PicoBoard one. The main aim of the project is attracting people to the programming world. The goal is also to provide a high level interface to Arduino programmers with functionalities such as interacting with a set of boards through user events.
Installing the Firmware into your Arduino
This firmware is a piece of software you need to install into your Arduino board to be able to communicate with it from S4A. Download and install the Arduino environment by following the instructions onhttp://arduino.cc/en/Main/Software. Take in account Arduino Uno requires at least version 0022.Download our firmware from here Connect your Arduino board to a USB port in your computerOpen the firmware file (S4AFirmware16.ino) from the Arduino environmentIn the Tools menu, select the board version and the serial port where the board is connected Load the firmware into your board through File > Upload
Step 2: Materials
To make it basic for the readers we will be making only one button controlled video game.
You will need:
A curious mind ;)
1 Arduino Board
Momentary Pushbutton Switch
1 resistor 220 ohms (or near this range)
Step 3: Selecting Sprites
You can select any sprite from the default sprites you want from the new sprites option present at the bottom right panel of the interface.
To make it dynamic you need to go to costumes and add costumes to the sprite selected
I selected the blue dog as it has three costumes.
You can also download new sprites from various websites online.
Step 4: Adjusting the Size of the Sprites Size
The sprites and the arduino board displayed on the display menu on the top right panel of the interface can be reduced by size and moved using the shrink size tab on top of the of the panel.
Step 5: Background
The background will give a nice effect to you video game.
Go to bottom right panel and select the stage option and select any stage from the default stages or you can add your own.
Step 6: Obstacle Sprites
Every video game has obstacles for the gamer to get thrilled about.
So here we will be selecting more sprites for obstacles.
I selected balls as my obstacle sprites from the new sprites option.
Step 7: Upload Arduino Block Code
Select the arduino from the bottom right panel and upload the block code by drag and drop from the left most block code panel as shown in the picture.
Step 8: Dog Sprite Code
Select the Dog sprite from the bottom right panel and upload the block code by drag and drop from the left most block code panel as shown in the picture.
Step 9: Upload Obstacle Ball Code
Select the Obstacle sprite from the bottom right panel and upload the block code by drag and drop from the left most block code panel as shown in the picture.
Step 10: Duplicating Obstacle
Just right on the obstacle sprite on the display panel and select duplicate and there you go, you have your obstacle duplicated.
Step 11: Adjusting the Up Down Movement of the Obstacle Sprite
Select the ball sprite and go the top panel as marked in the picture and change its direction to up.
Step 12: Hardware Connections
connect the hardware components as shown
Step 13: Final Step
Connect the arduino board to the laptop with the circuit and press the green flag on right corner of the interface and there you got you game is ready.