Tilt 'n' Turbo: a High-Speed Car Racing Game on the UNIHIKER Board

by vishalsoniindia in Circuits > Sensors

829 Views, 11 Favorites, 0 Comments

Tilt 'n' Turbo: a High-Speed Car Racing Game on the UNIHIKER Board

cover.jpg
1725373802221.jpg
UNIHIKER Car Racing Game: No Buttons, Just Tilt and Play!

Hello, fellow makers! 🚗💨

Ever dreamt of creating your own car racing game? Well, buckle up because today, we're diving into the fast-paced world of game development with the UNIHIKER board. Introducing Tilt 'n' Turbo, a thrilling car racing game where you control your car by simply tilting the board left and right. The accelerometer sensor reads your movements, allowing you to dodge oncoming enemy cars while your speed ramps up as you progress. Get ready for an adrenaline-pumping ride!

By the way, subscribe to my YouTube channel for more projects like this. I also update my upcoming projects on Instagram.

buy me a coffee! ☕: Paypal

Supplies

supplies.jpg
  1. UNIHIKER Board (amazon.com / amazon.in dfrobots )
  2. Type-C Cable (amazon.com / amazon.in / dfrobots )
  3. Laptop for programming

Setting Up the UNIHIKER

F5RMT7ALZ702J03.jpg
FOVJ8NPLZ702IZV.jpg
F7HJ0MZLZ702IZN.jpg
  1. Connect your UNIHIKER board to your PC via the Type-C cable.
  2. Once the board is powered on, navigate to the home screen.
  3. Press the HOME button and select the Service Toggle.
  4. Enable Jupyter Notebook for programming, and wait for it to activate.
  5. Now you're ready to start coding!

Uploading the Game Assets

F0XWJK9LZ702J10.jpg
FMHAG7XLZ702JI4.jpg

Before diving into the code, you'll need to upload the necessary game assets.

  1. Open your browser and enter "10.1.2.3" in the address bar.
  2. In the UNIHIKER interface, click on File Upload.
  3. Make sure the folder name field is empty.
  4. Click on "Click to Select File" and choose the Python file, then click on "Upload".

Download File From Github: https://github.com/vishalsoniindia/Tilt-n-Turbo-a-High-Speed-Car-Racing-Game-on-the-UNIHIKER-Board

Understanding the Game Mechanics

1725373802221.jpg
1725373802213.jpg

In Tilt 'n' Turbo, your car races forward automatically, and your mission is to avoid the enemy cars coming from the front. As you cross enemy cars, your speed increases, making the game more challenging. The left and right movement of your car is controlled by tilting the UNIHIKER board, with the built-in accelerometer detecting the tilt angle.

Testing the Game

1725373802203.gif

With the code in place, it's time to test your game!

  1. Run the Python script in Jupyter Notebook.
  2. Observe how the car moves left and right as you tilt the board.
  3. Make sure the enemy cars spawn correctly, and the speed increases as you progress.
  4. If everything works as expected, you're ready for the next step.

Run the Game on Startup

FWSQC14LZ702J3R.jpg
F2OASBJLZ702J3C.jpg
FDIVLPSLZ702J2Y.jpg

To make your game more user-friendly, you can set it to run automatically on startup.

  1. Go to the Service Toggle on the UNIHIKER board.
  2. Enable Auto Boot.
  3. In the Run Programs menu, select your game script (tilt_n_turbo.py).
  4. Now, whenever the board powers up, the game will start automatically after 5 seconds.

Enjoy the Game!

1725373802203.gif
1725373802221.jpg
1725373802213.jpg

You're done! Place the UNIHIKER board on the stand, tilt it left and right to dodge the enemy cars, and challenge your friends to beat your high score. Tilt 'n' Turbo is a perfect example of how you can combine hardware and software to create an engaging and interactive game.


buy me a coffee! ☕: Paypal