Truck Lane - a 16x2 LCD Arduino Game

18,137

12

15

About: Sucks at soldering, [hopefully] compensates with coding.

Intro: Truck Lane - a 16x2 LCD Arduino Game

Code: http://bit.ly/lcdtrucks
I was fooling around with the createChar() function to create cars.
How Sinclair ZX Spectrum :) Cars are small, so it's better to view them in full screen mode.
I'm using an Electronic Brick display (long story), but any Hitachi HD44780 compatible would do.

Share

    Recommendations

    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Audio Contest 2018

      Audio Contest 2018
    • Plastics Contest

      Plastics Contest

    15 Discussions

    0
    None
    litliao

    4 years ago on Introduction

    hi, there. It's such an interesting game. Would you mind if I add it to my tutorial as an example?

    1 reply
    0
    None
    thedodlitliao

    Reply 4 years ago on Introduction

    Hi.

    If what you're doing is not commercial, all you need to do is give me credit by linking here and to the license. If it's commercial - I'd like to know more ;)

    Anyway, note that "Truck Lane" is not a full instructable (e.g. there are no schematics). Perhaps Ariadne and/or Marble Disorder are more suitable for a tutorial.

    Once your tutorial is ready, please send me a link.

    All the best,

    The Dod.

    0
    None
    moeenf

    2 years ago

    It was so cool!

    0
    None
    moeenf

    2 years ago

    It was so cool!

    0
    None
    moeenf

    2 years ago

    It was so cool!

    0
    None
    mike.blais2

    3 years ago on Introduction

    Great Arduino game. Oh I connected a 10k potentiometer to A1 and my 16x2 display is connected to my uno using IIC/I2C/TWI/SPI Serial Interface on pin 4 and 5. Works great. Beside resetting the unit, how to restart game.

    you need to do these changes to use the serial interface

    remove

    #include <LiquidCrystal.h>

    LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);

    add

    #include <Wire.h>
    #include <LiquidCrystal_I2C.h> //need to downed if you don't have it

    LiquidCrystal_I2C lcd(0x27,16,2);

    change

    const int POTPIN = 1;

    to

    const int POTPIN = A1;

    in void setup()

    add

    lcd.init(); // initialize the lcd
    lcd.backlight(); //add this if you want backlight

    in all I used 8 wires for this game. I not sure can I use a 0.5 watt 8 ohm speaker for a Piezo speaker so I left that out.

    Works great

    0
    None
    bshapiro11

    3 years ago on Introduction

    What other pin setups can use. I have a joy stick sheild by sparkfun. https://www.sparkfun.com/tutorials/171 and it needs a lot of pins. I have 13 to 7 open and A2 to A5 open. I cant seem to make it run the program, I changed "LiquidCrystal lcd(12, 11, 5, 4, 3, 2);"to" LiquidCrystal lcd(12,11,10,9,8,7). any ideas??

    0
    None
    thedodcsats

    Reply 5 years ago on Introduction

    It's quite similar to the one at Ariadne: https://www.instructables.com/id/Ariadne-a-1st-person-maze-on-a-16x2-LCD/#step1
    The only differences is that Ariadne also has a push button.
    Ariadne also comes with a pde file (Truck Lane also had one, but I guess I've lost it :) ), and is much more fun to play.

    0
    None
    thedodcaptalex

    Reply 7 years ago on Introduction

    Thanks.
    Re pic: I've never tried working on anything less user-friendly than an Arduino. I'm a coder, not a warrior :) but it shouldn't be hard.
    As for 128x64 LCD: when you have real pixel-level graphics [IMHO] you don't need to resort to font glyphs.
    Trying to imitate truck lane would be aiming too low when you can place the obstacles (trucks, trees, etc.) on a grid of 64 instead of 5. You can easiily do a ski game with trees (maybe a few moving skiers). Looks more impressive and is a lot more fun to play.

    0
    None
    captalexthedod

    Reply 7 years ago on Introduction

    yes the ski game sounds cool, but whats crazy is how you made a scrolling game on an small lcd. anyway, i'm attempting snake at the moment but i dont know if the ski game your mentioned would be easier to implement on my system. i can move pixels and shapes on screen successfully . i just need the algorithm for moving objects and detecting collisions as you've done in your game.