Arduino游戏项目 - Arduino Flappy Bird的复制品

在这个Arduino项目中,我们将制作一个很酷的Arduino游戏,实际上是智能手机的流行Flappy鸟游戏的复制品,使用Arduino和TFT触摸屏。您可以通过观看以下视频来了解亚博88下载它是如何工作的,或者阅读下面的书面文本。

概述


游戏非常简单但有趣和上瘾。使用触摸屏我们控制鸟并尽量避免随着我们的进步而增加的移动支柱。此外,游戏也可以存储最高分,即使拔掉电源也是如此。

Birduino --- Arduino-Game-Project-Examply1

在前面的教程(Arduino TFT教程)我们详细学习了如何使用TFT触摸屏与一个Arduino,我们离开了游戏例如在本教程中加以解释。所以,现在,就像在以前的教程中,我们会一步一步来解释这背后的Arduino游戏的代码。

源代码


由于代码有点较长,并且更好地理解,我将在每个部分的描述中发布程序的源代码。并且在本文的末尾,我将发布完整的源代码。

我们将使用Henning Karlsen制作的UTFT和Urtouch库。您可以从他的网站下载这些库,www.rinkydinkyabo7. comelectronics.com.。此外,我们将使用EEPROM库存储EEPROM中的最高分。EEPROM是一个存储器即使在关闭电路板时也可以存储数据。

在我们包括库之后,我们需要创建UTFT和URTOUCH对象,并定义游戏所需的变量。在设置部分中,我们需要启动显示和触摸,从EEPROM读取最高分数,并使用initiategame()自定义函数启动游戏。

的#include 的#include 的#include  // ====创建对象UTFT myGLCD(SSD1289,38,39,40,41);//应将参数调整到显示/ Schield Model Urtouch MyTouch(6,5,4,3,2);// ====定义字体extern uint8_t smallfont [];extern uint8_t bigfont [];extern uint8_t sevensegnumfont [];的extern无符号整型bird01 [0x41A];//鸟位图INT的x,y;//对于变量在显示已被按下//软盘伯德INT XP = 319的坐标;INT YP = 100;INT YB = 50; int movingRate = 3; int fallRateInt = 0; float fallRate = 0; int score = 0; int lastSpeedUpScore = 0; int highestScore; boolean screenPressed = false; boolean gameStarted = false; void setup() { // Initiate display myGLCD.InitLCD(); myGLCD.clrScr(); myTouch.InitTouch(); myTouch.setPrecision(PREC_MEDIUM); highestScore = EEPROM.read(0); // Read the highest score from the EEPROM initiateGame(); // Initiate the game }

因此,使用initiategame()自定义功能,我们将绘制游戏的初始状态,这就是我们将如何做到这一点。首先,我们需要清除屏幕,然后绘制蓝色背景,绘制底部部分,添加文本并调用绘制鸟类()自定义功能绘制鸟。在此之后,我们需要一小时的循环,这将阻止游戏开始,直到我们点击屏幕。因此,虽然我们处于此状态,但如果我们按下右上角,我们可以将最高分的分数重置为零,如果我们在屏幕上的其他位置按下,我们将从WIST循环中取出并进入代码的主循环将开始游戏。

Birduino --- Arduino-Game-Project  - 开始屏幕

// ===== initiategame  - 自定义函数void initiategame(){myglcd.clrscr();//蓝色背景myGLCD.setColor(114,198,206);myGLCD.fillRect(0,0,319,239);//接地myGLCD.setColor(221216148);myGLCD.fillRect(0,215,319,239);myGLCD.setColor(47,175,68);myGLCD.fillRect(0,205,319,214);//文本myGLCD.setColor(0,0,0);myGLCD.setBackColor(221,216,148);myGLCD.setFont (BigFont); myGLCD.print("Score:",5,220); myGLCD.setFont(SmallFont); myGLCD.print("HowToMechatronics.com", 140, 220); myGLCD.setColor(0, 0, 0); myGLCD.setBackColor(114, 198, 206); myGLCD.print("Highest Score: ",5,5); myGLCD.printNumI(highestScore, 120, 6); myGLCD.print(">RESET<",255,5); myGLCD.drawLine(0,23,319,23); myGLCD.print("TAP TO START",CENTER,100); drawBird(yB); // Draws the bird // Wait until we tap the sreen while (!gameStarted) { if (myTouch.dataAvailable()) { myTouch.read(); x=myTouch.getX(); y=myTouch.getY(); // Reset higest score if ((x>=250) && (x<=319) &&(y>=0) && (y<=28)) { highestScore = 0; myGLCD.setColor(114, 198, 206); myGLCD.fillRect(120, 0, 150, 22); myGLCD.setColor(0, 0, 0); myGLCD.printNumI(highestScore, 120, 5); } if ((x>=0) && (x<=319) &&(y>=30) && (y<=239)) { gameStarted = true; myGLCD.setColor(114, 198, 206); myGLCD.fillRect(0, 0, 319, 32); } } } // Clears the text "TAP TO START" before the game start myGLCD.setColor(114, 198, 206); myGLCD.fillRect(85, 100, 235, 116); }

在主循环部分中,我们有XP变量,用于绘制柱子以及yp变量。在开始时,XP变量的值为319,因为屏幕的大小和yp变量的值为100,这是第一支柱的高度。每次迭代XP变量的值都会通过移动的变量的值减少,在开始时具有3的值,并且随着我们增加的游戏增加。

//主循环部分void循环(){XP = XP-vallatrate;// XP  -  x中的pilars的坐标;范围:319  - (-51)drawPilars(XP,YP);//绘制支柱// YB  - 其取决于fallingRate可变YB + = fallRateInt的值的鸟的y坐标;fallRate = fallRate + 0.4;//每个inetration下降率增加使我们能加速/重力fallRateInt的效果= INT(fallRate);//对于碰撞检查是否(YB> = 180 || YB <= 0){//顶部和底部GAMEOVER();}如果((XP <= 85)&&(XP> = 5)&&(YB <= YP-2)){//上支柱GAMEOVER();}如果((XP <= 85)&&(XP> = 5)&&(YB> = YP + 60)){//下柱GAMEOVER();} //绘制鸟drawBird(Yb)等 // After the pillar has passed through the screen if (xP<=-51){ xP=319; // Resets xP to 319 yP = rand() % 100+20; // Random number for the pillars height score++; // Increase score by one } //==== Controlling the bird if (myTouch.dataAvailable()&& !screenPressed) { fallRate=-6; // Setting the fallRate negative will make the bird jump screenPressed = true; } // Doesn't allow holding the screen / you must tap it else if ( !myTouch.dataAvailable() && screenPressed){ screenPressed = false; } // After each five points, increases the moving rate of the pillars if ((score - lastSpeedUpScore) == 5) { lastSpeedUpScore = score; movingRate++; } }

这是游戏的工作原则:我们有50个像素宽支柱,从右到左移动,每个下一个柱子都有不同的随机高度。为了使他们在逻辑上移动,在每次迭代之后,我们需要清除屏幕并用柱子以其新位置重绘图形。但是,我们不能这样做,因为屏幕的低刷新率,这会导致图形闪烁。为了激活其所有像素,屏幕需要更多的时间,因此我们将不得不即将开始和重绘那些正在移动的东西。

Birduino --- Arduino游戏 - 项目工作原理

所以让我们来看看TavePilars()自定义功能如何做到这一点。它需要XP和YP变量,并使用它们和填充()函数它将绘制支柱。因此,每次迭代都将柱子从左侧和右侧的额外蓝色矩形绘制,右侧,以这种方式清除先前的拔管,并以这种方式,我们实际上是刚刚重绘移动支柱的即兴创作。这里的IF语句是一个额外的即兴创作,因为由于某种原因,如果其“X2”参数具有屏幕大小的值,则填充()函数不起作用。此外,在此自定义功能的末尾,我们需要打印达到分数的值。

// ===== drawPlillars -自定义函数void drawPilars(int x, int y) {if (x>=270);改变颜色(0,200年,20);myGLCD.fillRect(318,0,X,Y-1);myglcd.setColor(0,0,0);myGLCD.drawRect(319,0,X-1,Y);myGLCD.setColor(0,200,20);myGLCD.fillRect(318,Y + 81,X,203);myglcd.setColor(0,0,0);myGLCD.drawRect(319,Y + 80,X-1,204);}否则如果(X <= 268){//绘制支柱myGLCD.setColor的蓝色矩形右边(114,198,206);myGLCD.fillRect(X + 51,0,X + 60,Y); // Draws the pillar myGLCD.setColor(0, 200, 20); myGLCD.fillRect(x+49, 1, x+1, y-1); // Draws the black frame of the pillar myGLCD.setColor(0, 0, 0); myGLCD.drawRect(x+50, 0, x, y); // Draws the blue rectangle left of the pillar myGLCD.setColor(114, 198, 206); myGLCD.fillRect(x-1, 0, x-3, y); // The bottom pillar myGLCD.setColor(114, 198, 206); myGLCD.fillRect(x+51, y+80, x+60, 204); myGLCD.setColor(0, 200, 20); myGLCD.fillRect(x+49, y+81, x+1, 203); myGLCD.setColor(0, 0, 0); myGLCD.drawRect(x+50, y+80, x, 204); myGLCD.setColor(114, 198, 206); myGLCD.fillRect(x-1, y+80, x-3, 204); } // Draws the score myGLCD.setColor(0, 0, 0); myGLCD.setBackColor(221, 216, 148); myGLCD.setFont(BigFont); myGLCD.printNumI(score, 100, 220); }

回到循环部分,我们有yB变量,它是鸟的y位置它取决于每次迭代后增加的下降率这样我们就得到了加速度或重力的影响。同样,我们在这里检查碰撞,并使用if语句来限制小鸟,这样如果它撞到顶部,地面或柱子,游戏就会结束。

Birduino --- Arduino的游戏项目 - 鸟

接下来是drawBird()自定义函数,让我们看看它是如何工作的。亚博88下载这只鸟实际上是一张照片,使用Henning Karlsen制作的ImageConverter565工具转换成位图。使用工具创建的“。c”文件需要包含在目录中,以便在启动草图时加载。我们还必须像这样定义位图,并使用drawBitmap()函数,我们将在屏幕上绘制照片。鸟有一个固定的X坐标和yB变量作为Y坐标。类似于柱子,我们将通过在鸟的上方和下方绘制两个蓝色矩形来清除鸟的先前状态。

// ====== drawbird() - 自定义函数void drawbird(int y){//绘制鸟类 -  Bitmap myglcd.drawbitmap(50,y,35,30,bird01);//绘制上方和下方的鸟蓝色矩形以清除其previus状态myGLCD.setColor(114,198,206);myGLCD.fillRoundRect(50,Y,85,Y-6);myGLCD.fillRoundRect(50,Y + 30,85,Y + 36);}

回到循环中,我们可以看到,在柱子通过屏幕后,XP变量将被重置为319,YP将从20到100的新的随机值为柱的高度,分数将增加一个。使用下一个陈述我们控制鸟。如果我们点击屏幕,我们会将下降的速度设置为负面将使鸟类跳跃以及如果语句不允许发生这种情况,如果我们只握住屏幕,那就不会发生这种情况。最后一个陈述是为了游戏的难度,并且它会在每个细点后增加柱的移动速度。

好的,现在留下了什么是了解游戏()自定义功能的工作原理。在延迟一秒钟后,它将清除屏幕,打印分数和一些文本,如果分数高于最高分,它将将其写入EEPROM,它会将所有变量重置为其起始位置值并结束它将调用initiategame()自定义函数重新启动游戏。

Birduino --- Arduino的游戏项目,游戏结束

// ====== GAMEOVER() - 自定义功能无效GAMEOVER(){延迟(1000);//1秒//清除屏幕和打印文本myGLCD.clrScr();myglcd.setcolor(255,255,255);myGLCD.setBackColor(0,0,0);myGLCD.setFont (BigFont);myGLCD.print( “GAME OVER”,CENTER,40);myGLCD.print( “分数”,100,80);myGLCD.printNumI(得分,200,80);myGLCD.print( “重新启动...”,CENTER,120);myglcd.setfont(sevEndebygnumfont); myGLCD.printNumI(2,CENTER, 150); delay(1000); myGLCD.printNumI(1,CENTER, 150); delay(1000); // Writes the highest score in the EEPROM if (score > highestScore) { highestScore = score; EEPROM.write(0,highestScore); } // Resets the variables to start position values xP=319; yB=50; fallRate=0; score = 0; lastSpeedUpScore = 0; movingRate = 3; gameStarted = false; // Restart game initiateGame(); }

就是这样,我希望代码的解释足够清楚。如果您有任何疑问,请随时在下面的意见部分询问。

这是游戏的完整代码:

/ * Arduino的游戏Proejct *计划方面取得由德扬Nedelkovski,* www.HowToMechatronics亚搏手机版官方下载.com * / / *该程序使用UTFT和URTouch库·亨宁卡尔森取得。*您可以找到并下载在他们:* www.RinkyDinkElectronics.com * /#包括的#include 的#include  // ====创建对象UTFT myGLCD(SSD1289,38,39,40,41);//应将参数调整到显示/ Schield Model Urtouch MyTouch(6,5,4,3,2);// ====定义字体extern uint8_t smallfont [];extern uint8_t bigfont [];extern uint8_t sevensegnumfont [];的extern无符号整型bird01 [0x41A];//鸟位图INT的x,y;//对于变量在显示已被按下//软盘伯德INT XP = 319的坐标;INT YP = 100; int yB = 50; int movingRate = 3; int fallRateInt = 0; float fallRate = 0; int score = 0; int lastSpeedUpScore = 0; int highestScore; boolean screenPressed = false; boolean gameStarted = false; void setup() { // Initiate display myGLCD.InitLCD(); myGLCD.clrScr(); myTouch.InitTouch(); myTouch.setPrecision(PREC_MEDIUM); highestScore = EEPROM.read(0); // Read the highest score from the EEPROM initiateGame(); // Initiate the game } void loop() { xP=xP-movingRate; // xP - x coordinate of the pilars; range: 319 - (-51) drawPilars(xP, yP); // Draws the pillars // yB - y coordinate of the bird which depends on value of the fallingRate variable yB+=fallRateInt; fallRate=fallRate+0.4; // Each inetration the fall rate increase so that we can the effect of acceleration/ gravity fallRateInt= int(fallRate); // Checks for collision if(yB>=180 || yB<=0){ // top and bottom gameOver(); } if((xP<=85) && (xP>=5) && (yB<=yP-2)){ // upper pillar gameOver(); } if((xP<=85) && (xP>=5) && (yB>=yP+60)){ // lower pillar gameOver(); } // Draws the bird drawBird(yB); // After the pillar has passed through the screen if (xP<=-51){ xP=319; // Resets xP to 319 yP = rand() % 100+20; // Random number for the pillars height score++; // Increase score by one } //==== Controlling the bird if (myTouch.dataAvailable()&& !screenPressed) { fallRate=-6; // Setting the fallRate negative will make the bird jump screenPressed = true; } // Doesn't allow holding the screen / you must tap it else if ( !myTouch.dataAvailable() && screenPressed){ screenPressed = false; } // After each five points, increases the moving rate of the pillars if ((score - lastSpeedUpScore) == 5) { lastSpeedUpScore = score; movingRate++; } } // ===== initiateGame - Custom Function void initiateGame() { myGLCD.clrScr(); // Blue background myGLCD.setColor(114, 198, 206); myGLCD.fillRect(0,0,319,239); // Ground myGLCD.setColor(221,216,148); myGLCD.fillRect(0, 215, 319, 239); myGLCD.setColor(47,175,68); myGLCD.fillRect(0, 205, 319, 214); // Text myGLCD.setColor(0, 0, 0); myGLCD.setBackColor(221, 216, 148); myGLCD.setFont(BigFont); myGLCD.print("Score:",5,220); myGLCD.setFont(SmallFont); myGLCD.print("HowToMechatronics.com", 140, 220); myGLCD.setColor(0, 0, 0); myGLCD.setBackColor(114, 198, 206); myGLCD.print("Highest Score: ",5,5); myGLCD.printNumI(highestScore, 120, 6); myGLCD.print(">RESET<",255,5); myGLCD.drawLine(0,23,319,23); myGLCD.print("TAP TO START",CENTER,100); drawBird(yB); // Draws the bird // Wait until we tap the sreen while (!gameStarted) { if (myTouch.dataAvailable()) { myTouch.read(); x=myTouch.getX(); y=myTouch.getY(); // Reset higest score if ((x>=250) && (x<=319) &&(y>=0) && (y<=28)) { highestScore = 0; myGLCD.setColor(114, 198, 206); myGLCD.fillRect(120, 0, 150, 22); myGLCD.setColor(0, 0, 0); myGLCD.printNumI(highestScore, 120, 5); } if ((x>=0) && (x<=319) &&(y>=30) && (y<=239)) { gameStarted = true; myGLCD.setColor(114, 198, 206); myGLCD.fillRect(0, 0, 319, 32); } } } // Clears the text "TAP TO START" before the game start myGLCD.setColor(114, 198, 206); myGLCD.fillRect(85, 100, 235, 116); } // ===== drawPlillars - Custom Function void drawPilars(int x, int y) { if (x>=270){ myGLCD.setColor(0, 200, 20); myGLCD.fillRect(318, 0, x, y-1); myGLCD.setColor(0, 0, 0); myGLCD.drawRect(319, 0, x-1, y); myGLCD.setColor(0, 200, 20); myGLCD.fillRect(318, y+81, x, 203); myGLCD.setColor(0, 0, 0); myGLCD.drawRect(319, y+80, x-1, 204); } else if( x<=268) { // Draws blue rectangle right of the pillar myGLCD.setColor(114, 198, 206); myGLCD.fillRect(x+51, 0, x+60, y); // Draws the pillar myGLCD.setColor(0, 200, 20); myGLCD.fillRect(x+49, 1, x+1, y-1); // Draws the black frame of the pillar myGLCD.setColor(0, 0, 0); myGLCD.drawRect(x+50, 0, x, y); // Draws the blue rectangle left of the pillar myGLCD.setColor(114, 198, 206); myGLCD.fillRect(x-1, 0, x-3, y); // The bottom pillar myGLCD.setColor(114, 198, 206); myGLCD.fillRect(x+51, y+80, x+60, 204); myGLCD.setColor(0, 200, 20); myGLCD.fillRect(x+49, y+81, x+1, 203); myGLCD.setColor(0, 0, 0); myGLCD.drawRect(x+50, y+80, x, 204); myGLCD.setColor(114, 198, 206); myGLCD.fillRect(x-1, y+80, x-3, 204); } // Draws the score myGLCD.setColor(0, 0, 0); myGLCD.setBackColor(221, 216, 148); myGLCD.setFont(BigFont); myGLCD.printNumI(score, 100, 220); } //====== drawBird() - Custom Function void drawBird(int y) { // Draws the bird - bitmap myGLCD.drawBitmap (50, y, 35, 30, bird01); // Draws blue rectangles above and below the bird in order to clear its previus state myGLCD.setColor(114, 198, 206); myGLCD.fillRoundRect(50,y,85,y-6); myGLCD.fillRoundRect(50,y+30,85,y+36); } //======== gameOver() - Custom Function void gameOver() { delay(3000); // 1 second // Clears the screen and prints the text myGLCD.clrScr(); myGLCD.setColor(255, 255, 255); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(BigFont); myGLCD.print("GAME OVER", CENTER, 40); myGLCD.print("Score:", 100, 80); myGLCD.printNumI(score,200, 80); myGLCD.print("Restarting...", CENTER, 120); myGLCD.setFont(SevenSegNumFont); myGLCD.printNumI(2,CENTER, 150); delay(1000); myGLCD.printNumI(1,CENTER, 150); delay(1000); // Writes the highest score in the EEPROM if (score > highestScore) { highestScore = score; EEPROM.write(0,highestScore); } // Resets the variables to start position values xP=319; yB=50; fallRate=0; score = 0; lastSpeedUpScore = 0; movingRate = 3; gameStarted = false; // Restart game initiateGame(); }

这是一个带有Arduino Sketck的下载文件,鸟图像和鸟的位图文件。

16回应

  1. Heyte.

    UTFT MyGlcd(SSD1289,38,39,40,41);//应将参数调整到显示/ schield

    我可以在我的Mega 2560上找到SDA(20)和SCL(21),但不是CS和RTS:错误?
    我的TFT LCD屏幕ili9488 3.95“我没有任何盾牌。(你在早期的评论中告诉我,我没有为我的屏幕不需要它)

    回复
  2. alim

    嗨此代码不起作用。我使用1.6.5 Arduino IDE但不起作用。#include不起作用。Arduino警告栏在说没有这样的事情。请帮忙。而且也是
    #包括有同样的问题。

    回复
  3. Sindrus.

    你好!

    当我尝试将游戏上传到董事会时,我会得到这些错误:

    用户/ sindrehodneland /文档/阿尔杜伊诺/ sketch_bird / sketch_bird.ino:在函数“void initiateGame()”:

    /users/sindrehodneland/documents/arduino/sketch_bird/sketch_bird.ino:107:30:警告:从字符串常量弃用转换为'char *'[-wwrite-strings]
    myglcd.print(“得分:”,5,220);
    ^
    /users/sindrehodneland/documents/arduino/sketch_bird/sketch_bird.ino:109:49:警告:从字符串常量弃用转换为'char *'[-wwrite-strings]
    myGLCD.print(“亚搏手机版官方下载HowToMechatronics.com”,140,220);
    ^
    /Users/sindrehodneland/Documents/Arduino/sketch_bird/sketch_bird.ino:112:37:警告:从字符串常量弃用转换“的char *” [-Wwrite串]
    myglcd.print(“最高分:”,5,5);
    ^
    /users/sindrehodneland/documents/arduino/sketch_bird/sketch_bird.ino:114:31:警告:从字符串常量弃用转换为'char *'[-wwrite-strings]
    myglcd.print(“>重置<”,255,5);
    ^
    /Users/sindrehodneland/Documents/Arduino/sketch_bird/sketch_bird.ino:116:41:警告:从字符串常量弃用转换“的char *” [-Wwrite串]
    myGLCD.print( “TAP TO START”,CENTER,100);
    ^
    /用户/ sindrehodneland /文件/ Arduino / sketch_bird / sketch_bird。在函数“void gameOver()”中:
    /users/sindrehodneland/documents/arduino/sketch_bird/sketch_bird.ino:204:39:警告:从字符串常量弃用转换为'char *'[-wwrite-strings]
    myGLCD.print( “GAME OVER”,CENTER,40);
    ^
    /用户/ sindrehodneland /文件/ Arduino / sketch_bird / sketch_bird。ino:205:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
    myGLCD.print( “分数”,100,80);
    ^
    /users/sindrehodneland/documents/arduino/sketch_bird/sketch_bird.ino:207:44:警告:从字符串常量向'char *'[-wwrite-strings]弃用转换
    myglcd.print(“重新启动......”,中心,120);
    ^
    草图/ sketch_bird.ino.cpp.o:在功能`drawBird(INT)':
    /Users/sindrehodneland/Documents/Arduino/sketch_bird/sketch_bird.ino:190:未定义参考`bird01'
    /Users/sindrehodneland/Documents/Arduino/sketch_bird/sketch_bird.ino:190:未定义参考`bird01'
    Collect2:错误:LD返回1个退出状态
    退出状态1.

    你知道这意味着什么,以及如何解决它?

    回复
    • Dejan Nedelkovski.

      您是否正确跟随了所有步骤,您是否检查了Arduino TFT LCD教程。它看起来一些功能不适合你。您是否尝试过图书馆的演示示例?

      回复
  4. Bilal

    嗨,当我添加Bird01.c文件时,您在下载链接中提供。我得到剪影太大了。素描使用40.484字节最多是32.256字节......说。我如何解决这个问题。谢谢

    回复
  5. 我再次运行代码并此时收到此错误;

    (素描中的文件)blink.o:在功能`绘制(int)'中:
    blink.cpp :(。text._z8drawbirdi + 0x2a):未定义引用“bird01”
    blink.cpp :(。text._z8drawbirdi + 0x2e):未定义引用`bird01'
    blink.cpp :(。text._z8drawbirdi + 0x8e):未定义引用`bird01'
    Blink.cpp:(.text._Z8drawBirdi+0x92): undefined reference to ' bird01 '

    回复
  6. 艾伦

    我可以使用代码和库为其他波段与相同的pinout,如飞思卡尔KL25Z?
    谢谢。

    回复
  7. 桑德拉

    嗨,这太棒了。

    我在编程微控制器,全新的(但我没有当然的计算机上的程序)。我编的游戏程序,并上传成功了。但是显示效果只泛着灰色。我只好去其他地方连接的东西比屏蔽和显示?像某种按钮即可启动程序?我想我有完全像你一样的硬件,从这里买了它:
    [链接删除]
    或者我需要在程序开头更改参数吗?
    等不及要玩游戏我的Arduino =)我希望你能帮助我找到错误。非常感谢源代码的剪切和视频的说明。

    亲切的问候,
    桑德拉

    回复
  8. 大卫

    你好,
    谢谢你的有趣的游戏〜
    实际上,我有一个问题,我找到了一个解决方案。
    我不知道为什么究竟。^^ ;;
    我使用arduino due + 3.2″TFT LCD(320QVT_9341)。
    当我运行代码时,有一个如下错误
    。错误信息 :
    退出状态1.
    无法拨打“UTFT :: drawbitmap(int,int&,int,int,unsigned int [1050])'没有匹配函数

    所以,我试图解决这个错误,最后我像下面那样解决了。
    我不得不改变这样:extern unsigned int bird01 [0x41a] - > extern unsigned short bird01 [0x41a]

    PLZ,解释为什么?

    回复

发表评论

您的电子邮件地址不会被公开。

推荐

2019年初学者和爱好者的最佳进入级示波器

为初学者和爱好者最好的示波器

推荐

2019年初学者的8个最佳Arduino Starter Kits

初学者的8个最佳Arduino Starter Kits

推荐

用于初学者和爱好者的最佳3D打印机 -  3D打印

初学者和爱好者的最佳3D打印机