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
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
- UNIHIKER Board (amazon.com / amazon.in / dfrobots )
- Type-C Cable (amazon.com / amazon.in / dfrobots )
- Laptop for programming
Setting Up the UNIHIKER
- Connect your UNIHIKER board to your PC via the Type-C cable.
- Once the board is powered on, navigate to the home screen.
- Press the HOME button and select the Service Toggle.
- Enable Jupyter Notebook for programming, and wait for it to activate.
- Now you're ready to start coding!
Uploading the Game Assets
Before diving into the code, you'll need to upload the necessary game assets.
- Open your browser and enter "10.1.2.3" in the address bar.
- In the UNIHIKER interface, click on File Upload.
- Make sure the folder name field is empty.
- 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
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
With the code in place, it's time to test your game!
- Run the Python script in Jupyter Notebook.
- Observe how the car moves left and right as you tilt the board.
- Make sure the enemy cars spawn correctly, and the speed increases as you progress.
- If everything works as expected, you're ready for the next step.
Run the Game on Startup
To make your game more user-friendly, you can set it to run automatically on startup.
- Go to the Service Toggle on the UNIHIKER board.
- Enable Auto Boot.
- In the Run Programs menu, select your game script (tilt_n_turbo.py).
- Now, whenever the board powers up, the game will start automatically after 5 seconds.
Enjoy the Game!
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