#include "Display.h"
#include "Sprites.h"
#include "Classes.h"
unsigned long systime, timestamp, timestamp1;
//Objekte erstellen:
//->(String name, byte width, byte height, int16_t xCoord, int16_t yCoord)
Noodle Penne ("Penne",30,64,150,156,nudelSprite);
//->(Name, width, heigth, xCoord, yCoord)
Board Board3 ("Board3",66,10,150,131,plattformSprite);
Board Board2 ("Board2",66,10,40,194,plattformSprite);
Board Board ("Board",66,10,120,257,plattformSprite);
//->Button: (Name, Pinnummer)
Button LEFT ("LEFT",5);
Button RIGHT ("RIGHT",3);
void setup(){
Serial.begin(9600);
randomSeed(analogRead(A0));
tft.begin();
tft.setRotation(0);
Serial.println("Welcome to NoodleJump Demo");
Serial.println("*** Use arrow keys on your keyboard to navigate the Noodle. ***");
// Draw border
tft.drawRect(0, 0, tft.width(), tft.height(), tft.color565(80, 80, 80));
}
void loop() {
systime = millis();
if (Penne.getStop() == false){
Penne.jump(systime);
if (systime - timestamp >= 200) {
Board.move();
Board2.move();
Board3.move();
Penne.checkCollision(Board.getYCoord(),Board.getXCoord(), Board2.getYCoord(),Board2.getXCoord(), Board3.getYCoord(),Board3.getXCoord());
timestamp = systime;
}
}
if (systime - timestamp1 >= 51) {
LEFT.readButton();
RIGHT.readButton();
timestamp1 = systime;
if (LEFT.getStatus()){
Penne.setPosition(-10);
}
if (RIGHT.getStatus()){
Penne.setPosition(10);
}
}
}