Using gen-uLCD-24DT, we will make our own version of one of the best and most addictive games of all time- the Classic Snake Game. This game uses the 240x320 pixel resolution of the gen4 HMI display as the game area. A thumb joystick module is interfaced with the gen4 HMI display to control the head of the snake and collect its food. Collect all the food to grow as long as possible but don't hit the wall, or eat your tail!
How it WorksBuild the circuit as shown in the diagram.
- Open the project using Workshop 4. This project uses the Visi Environment.
- You can modify the properties of each widget.
- You can modify the properties of the game in this section where the variables and constants are declared:
- You can also check and modify some part of the code according to your preferences. The section below shows how does does a new fruit/box is added into the game, and how the program determines when the snake has eaten that box:
- Set another background by changing the background image. Just make sure you paste the code after every graphics update.
- Click on the “Compile” button.
Note: This step could be skipped. However, compiling is essential for debugging purposes.
Step 4: Comms Port- Connect the display to the PC. Make sure that you are connected to the right port. Red Button indicates that the device is not connected, Blue Button indicates that the device is connected to the right port.
- Go back to “Home” tab. This time, click on the “Comp’nLoad” button.
- Workshop 4 will prompt you to select a drive to copy the image files to a uSD Card. After selecting the correct drive, click OK.
- When the micro SD card is not yet inserted, this message will appear on your gen4 Display:
- After inserting your micro SD card this GUI should appear on the gen4 Display:
Comments