ELEC2645 (2017/18) / Mbed 2 deprecated el17yw

Dependencies:   mbed

Committer:
RickYu
Date:
Sat May 05 20:27:06 2018 +0000
Revision:
30:057301068dac
Parent:
29:f3e24ccc401d
fix the bug in the menu

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RickYu 3:1a134243e2f0 1 #include "boom.h"
RickYu 3:1a134243e2f0 2 boom::boom()
RickYu 3:1a134243e2f0 3 {
RickYu 3:1a134243e2f0 4 }
RickYu 3:1a134243e2f0 5 boom::~boom()
RickYu 3:1a134243e2f0 6 {
RickYu 3:1a134243e2f0 7 }
RickYu 3:1a134243e2f0 8
RickYu 3:1a134243e2f0 9 void boom::init(int x,int y)
RickYu 3:1a134243e2f0 10 {
RickYu 27:eab2cf10554e 11 boom_x = x; //initialise the boom position
RickYu 3:1a134243e2f0 12 boom_y = y;
RickYu 3:1a134243e2f0 13 }
RickYu 3:1a134243e2f0 14
RickYu 3:1a134243e2f0 15 void boom::draw(N5110 &lcd)
RickYu 3:1a134243e2f0 16 {
RickYu 7:1964f649676e 17 //draw the boom on the screen
RickYu 6:46d0caedf217 18 lcd.drawCircle(boom_x,boom_y,2,FILL_TRANSPARENT);
RickYu 3:1a134243e2f0 19 }
RickYu 3:1a134243e2f0 20
RickYu 4:55d904040636 21 void boom::update()
RickYu 3:1a134243e2f0 22 {
RickYu 7:1964f649676e 23 //set the falling speed of boom
RickYu 7:1964f649676e 24 //let the boom move with set speed
RickYu 18:78001ecadcb2 25 boom_speed = 4;
RickYu 29:f3e24ccc401d 26 boom_y+= boom_speed;
RickYu 30:057301068dac 27 boom_x+= 2;
RickYu 27:eab2cf10554e 28 }
RickYu 9:d217a636c18d 29
RickYu 5:0a116644cce2 30 Vector2D boom::get_pos()
RickYu 5:0a116644cce2 31 {
RickYu 5:0a116644cce2 32 Vector2D p = {boom_x,boom_y};
RickYu 5:0a116644cce2 33 return p;
RickYu 5:0a116644cce2 34 }
RickYu 7:1964f649676e 35 void boom::set_pos(Vector2D p1)
RickYu 5:0a116644cce2 36 {
RickYu 7:1964f649676e 37 boom_x = p1.x;
RickYu 7:1964f649676e 38 boom_y = p1.y;
RickYu 3:1a134243e2f0 39 }
RickYu 3:1a134243e2f0 40
RickYu 3:1a134243e2f0 41