Implement basic functions.

Dependencies:   mbed N5110

Committer:
Wuuu
Date:
Fri May 03 13:03:59 2019 +0000
Revision:
0:7173d91b03e1
Copter, which with header programme.

Who changed what in which revision?

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