Arduino color game (Bomber) using VGA library

I don't understand the use of the analog pin in this way since you can use the analog pin as digital as written here http://www.arduino.cc/en/Tutorial/AnalogInputPins

Pin mapping

The analog pins can be used identically to the digital pins, using the aliases A0 (for analog input 0), A1, etc. For example, the code would look like this to set analog pin 0 to an output, and to set it HIGH:

[ltr][color=#4f4e4e]pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);[/color][/ltr]

Anyway this is a sketch that I must try! :)

dear zoomx, I applied the correction you suggest. The behaviour is the same but the code is more understandable. Now the code has:

#define BUTTON_PIN A0
//#define BUTTON_PIN A2 
.
.
.
void processInputs() {
  wheelPosition = analogRead(WHEEL_PIN);
  buttonStatus = digitalRead(BUTTON_PIN) ; 
}

instead of:

#define BUTTON_PIN 0
//#define BUTTON_PIN 2 
.
.
.
void processInputs() {
  wheelPosition = analogRead(WHEEL_PIN);
  buttonStatus = (analogRead(BUTTON_PIN) > 512); 
}

I understand a bit more now! I am glad you want to try it. Let me know!

Good work Rob Cai! Your game is the first that use VGAX! In the next commit i will add your game in the github notes. Thank you!

A second version of “Arduino Bomber” is ready!

It uses the recent “VGAXUtils.h” written by Smaffer, to draw lines, circles, rectangles, and so on (see his post for details).

The code has needed deep modifications to be compatible with these functions, but the screen is now drawn roughly ten times faster and the game became more smooth and precise.

The code is attached here.
As said before: enjoy!

P.S. the second file (bomber_alpha.ino) is the “old” version for TVout libraries

VGAX_Bomber_v02.ino (15.8 KB)

bomber_alpha.ino (7.88 KB)

Cool game Rob :)

I have done a “new” game:

Pong with colors and sound, running for a VGA monitor.

Link to the video here:

As for “Bomber”, this game does not need a special shield or support chips, but just few resistors, a DSUB15 connector, a pair of potenziometers and a buttons.

Since I am using only one potenziometer and button, the two paddles move in parallel. Anyway, the code is ready for the “second player”.

The code is at the bottom.
Enjoy!

NB second version at #13

pong_VGAx.ino (16.6 KB)

complimenti. sicuramente cercherò di riprodurlo.

Grazie, fammi sapere come va. Se hai domande, chiedi pure!

Hi Smaffer,

it is really unbelievable what you have done with a bare Arduino, without the help of any other supporting chip!

When you will publish the first release of the game, I will be one of the first to download and try it.

Cheers.

Pong VGA with colors and for two players is ready!

The code has been updated for the latest VGAx library by Smaffer (August 2015) and overall optimized for two separated players. Many bugs have been fixed, expecially involving the restart of a new match.

In this video, I show the whole setup placed in two rock solid wood box. A bigger one for the Arduino board, the DSUB15 connector and the first player button and wheel; the second player paddle, containing only his button and wheel, is connected to the main one with a recycled USB cable and socket. In this way the main box can be used for my previous single player game (Arduino Bomber).

The code is at the bottom.

Enjoy!

pong_VGAx_v1.1.ino (18.7 KB)

So fu*king cool will sure try it out!

As for "Arduino Bomber": I noticed this line in the code:

  Vaereo = 0.1 + random(20)/100;

Won't that always give you 0.1 ? (because random(20)/100 will always give you 0)

Ok rob_cai, COLOR PONG works! :D

|393x500

Thanks for the code.

To odometer: yes, correct - in VGAX_Bomber_v02 - I modified it to:

Vaereo = random(200)/100.0 + 2 + 2*level;

and the plane speed is increased.

To Space_Invader: thank you for the comment. Are you using an home made Arduino? Cool!

JUNKHACK has reproduced a very cool PONG console using a real ping pong paddle to hold together the components and two white balls for the potentiometers, as shown here.

Well done Junkhack!

|500x375

I tryed to upload the code on an Arduino NANO ATmega328 (as Junkhank did already), and it works!

|375x500

|500x421

Some of you may know that I love messing around with AVR's and Video

My latest challenge incorporates a ATMEGA8 at 16Mhz

I have made a simple PCB so that I can create 15bit colour (6R, 6B, 3G) in VGA 200 pixels wide for text display should give me about 33 5x7 characters across the screen

One section of the screen is text, the other will be graphics, I wont be using the ram as a screen map (well the mega8 only has 1k !) so all the graphics will be prepared line-by-line before it is drawn

I based some of my work on Smaffers original code, thanks for that Smaffer !!

Why not try it on a '1284P, 16K SRAM, lots more options.

CrossRoads: Why not try it on a '1284P, 16K SRAM, lots more options.

I have done quite a few video projects on the 1284, I love that thing ! I just like to try some trickier ideas now and again, trying to get blood out of a stone !

Another classic game is in progress...

|500x411

...Arduino VGA snake