ELEC2645 (2017/18) / Mbed 2 deprecated el17yw

Dependencies:   mbed

Committer:
RickYu
Date:
Mon Apr 30 20:29:26 2018 +0000
Revision:
27:eab2cf10554e
Parent:
18:78001ecadcb2
Child:
29:f3e24ccc401d
wriitten all the  comments

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 27:eab2cf10554e 26 boom_y+= boom_speed;
RickYu 27:eab2cf10554e 27 }
RickYu 9:d217a636c18d 28
RickYu 5:0a116644cce2 29 Vector2D boom::get_pos()
RickYu 5:0a116644cce2 30 {
RickYu 5:0a116644cce2 31 Vector2D p = {boom_x,boom_y};
RickYu 5:0a116644cce2 32 return p;
RickYu 5:0a116644cce2 33 }
RickYu 7:1964f649676e 34 void boom::set_pos(Vector2D p1)
RickYu 5:0a116644cce2 35 {
RickYu 7:1964f649676e 36 boom_x = p1.x;
RickYu 7:1964f649676e 37 boom_y = p1.y;
RickYu 3:1a134243e2f0 38 }
RickYu 3:1a134243e2f0 39
RickYu 3:1a134243e2f0 40