Implement basic functions

Dependencies:   mbed N5110

Committer:
Wuuu
Date:
Fri May 03 13:05:24 2019 +0000
Revision:
0:64bd9f996099
Flappy Bird, which with header programme

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wuuu 0:64bd9f996099 1 #include "Bird.h"
Wuuu 0:64bd9f996099 2
Wuuu 0:64bd9f996099 3 Bird::Bird()
Wuuu 0:64bd9f996099 4 {
Wuuu 0:64bd9f996099 5
Wuuu 0:64bd9f996099 6 }
Wuuu 0:64bd9f996099 7
Wuuu 0:64bd9f996099 8 Bird::~Bird()
Wuuu 0:64bd9f996099 9 {
Wuuu 0:64bd9f996099 10
Wuuu 0:64bd9f996099 11 }
Wuuu 0:64bd9f996099 12
Wuuu 0:64bd9f996099 13 void Bird::init()
Wuuu 0:64bd9f996099 14 {
Wuuu 0:64bd9f996099 15 _h = 16;
Wuuu 0:64bd9f996099 16 }
Wuuu 0:64bd9f996099 17
Wuuu 0:64bd9f996099 18 int Bird::draw(N5110 &lcd,Gamepad &pad)
Wuuu 0:64bd9f996099 19 {
Wuuu 0:64bd9f996099 20 int sprite_data1[] = {
Wuuu 0:64bd9f996099 21 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 22 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 23 0,0,0,1,0,0,0,0,
Wuuu 0:64bd9f996099 24 0,0,0,1,1,0,0,0,
Wuuu 0:64bd9f996099 25 0,0,0,1,1,1,0,0,
Wuuu 0:64bd9f996099 26 0,0,0,1,1,1,0,0,
Wuuu 0:64bd9f996099 27 1,1,1,1,1,1,1,1,
Wuuu 0:64bd9f996099 28 1,1,1,1,1,1,1,0,
Wuuu 0:64bd9f996099 29 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 30 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 31 };
Wuuu 0:64bd9f996099 32 int sprite_data2[] = {
Wuuu 0:64bd9f996099 33 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 34 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 35 1,1,1,1,1,1,1,0,
Wuuu 0:64bd9f996099 36 1,1,1,1,1,1,1,1,
Wuuu 0:64bd9f996099 37 0,0,0,1,1,1,0,0,
Wuuu 0:64bd9f996099 38 0,0,0,1,1,1,0,0,
Wuuu 0:64bd9f996099 39 0,0,0,1,1,0,0,0,
Wuuu 0:64bd9f996099 40 0,0,0,1,0,0,0,0,
Wuuu 0:64bd9f996099 41 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 42 0,0,0,0,0,0,0,0,
Wuuu 0:64bd9f996099 43 };
Wuuu 0:64bd9f996099 44 if(pad.check_event(Gamepad::A_PRESSED) == true){
Wuuu 0:64bd9f996099 45 _h = _h - 7;
Wuuu 0:64bd9f996099 46 Bitmap sprite(sprite_data1, 10, 8);
Wuuu 0:64bd9f996099 47 sprite.render(lcd,1,_h);
Wuuu 0:64bd9f996099 48 }else{
Wuuu 0:64bd9f996099 49 _h = _h + 3;
Wuuu 0:64bd9f996099 50 Bitmap sprite(sprite_data2, 10, 8);
Wuuu 0:64bd9f996099 51 sprite.render(lcd,1,_h);
Wuuu 0:64bd9f996099 52 }
Wuuu 0:64bd9f996099 53 return _h;
Wuuu 0:64bd9f996099 54 }