How to make a Flappy Bird Game using
The ESP32 module is a low-cost development board that can create various projects. In this video, I'll show you how to use the ESP32 module to play the Flappy Bird game!
By following along, you'll learn how to use the ESP32 module and create your own Flappy Bird game! Just follow these steps:
1. Put the ESP32 on a breadboard
2. Connect the OLED's SDA and SCL to D21 and D22 of ESP32 respectively.
3. Connect the Vcc and GND to +5v and GND respectively.
3. Connect the touch button to digital pin 5 of ESP32 and connect the GND and VCC of the touch sensor to GND and +5V
4. Upload the code. (pinned in comments)
#esp32project #esp32game
Пікірлер: 5
Code: #include #include "SSD1306Wire.h" #include "images.h" #include "fontovi.h" SSD1306Wire display(0x3c, 21, 22); #define DEMO_DURATION 3000 typedef void (*Demo)(void); float zidx[4]; int prazan[4]; int razmak = 32; int sirinaProlaza = 30; #define TOUCH_BUTTON_PIN 5 void setup() { Serial.begin(9600); Serial.println(); Serial.println(); pinMode(2, OUTPUT); pinMode(23, OUTPUT); pinMode(TOUCH_BUTTON_PIN, INPUT_PULLUP); display.init(); for (int i = 0; i zidx[i] = 128 + ((i + 1) * razmak); prazan[i] = random(8, 32); } display.flipScreenVertically(); display.setFont(ArialMT_Plain_10); } int score = 0; int stis = 0; float fx = 30.00; float fy = 22.00; int smjer = 0; unsigned long trenutno = 0; int igra = 0; int frame = 0; int sviraj = 0; unsigned long ton = 0; void loop() { display.clear(); if (igra == 0) { display.setFont(ArialMT_Plain_16); display.drawString(0, 4, "Flappy "); display.drawXbm(0, 0, 128, 64, pozadina); display.drawXbm(20, 32, 14, 9, ptica); display.setFont(ArialMT_Plain_10); display.drawString(0, 44, "Press to start"); delay(3000); if (digitalRead(TOUCH_BUTTON_PIN) == LOW) { igra = 1; } } if (igra == 1) { display.setFont(ArialMT_Plain_10); display.drawString(3, 0, String(score)); if (digitalRead(TOUCH_BUTTON_PIN) == LOW) { if (stis == 0) { trenutno = millis(); smjer = 1; sviraj = 1; stis = 1; ton = millis(); } } else { stis = 0; } for (int j = 0; j display.setColor(WHITE); display.fillRect(zidx[j], 0, 6, 64); display.setColor(BLACK); display.fillRect(zidx[j], prazan[j], 6, sirinaProlaza); } display.setColor(WHITE); display.drawXbm(fx, fy, 14, 9, ptica); for (int j = 0; j zidx[j] = zidx[j] - 0.01; if (zidx[j] score = score + 1; digitalWrite(23, 1); prazan[j] = random(8, 32); zidx[j] = 128; } } if ((trenutno + 185) smjer = 0; } if ((ton + 40) sviraj = 0; } if (smjer == 0) { fy = fy + 0.01; } else { fy = fy - 0.03; } if (sviraj == 1) { digitalWrite(23, 1); } else { digitalWrite(23, 0); } if (fy > 63 || fy igra = 0; fy = 22; score = 0; digitalWrite(23, 1); delay(500); digitalWrite(23, 0); for (int i = 0; i zidx[i] = 128 + ((i + 1) * razmak); prazan[i] = random(8, 32); } } for (int m = 0; m if (zidx[m]
Nice one 💯
Wow awesome bruh 🎉
Images.h and fontovi.h where is the code present?
How to copy code from your comment?