ELEC2645 (2017/18) / Mbed 2 deprecated el17yw

Dependencies:   mbed

boom/boom.cpp

Committer:
RickYu
Date:
2018-04-15
Revision:
3:1a134243e2f0
Child:
4:55d904040636

File content as of revision 3:1a134243e2f0:

#include "boom.h"

boom::boom()
{

}

boom::~boom()
{

}


void boom::init(int x,int y)
{
    boom_x = x;
    boom_y = y;
    //boom_speed = 5;  // default speed
   

}

void boom::draw(N5110 &lcd)
{
     lcd.drawCircle(boom_x+3,boom_y+3,3,FILL_TRANSPARENT);
    
    
}

void boom::update(Direction d,float mag)
{
    boom_speed = rand()%10;
    boom_y+= boom_speed; 


    // check the y origin to ensure that the paddle doesn't go off screen
    if (boom_y < 1) {
        boom_y = 0;
    }
    if (boom_y > 48) {
        boom_y = 45;
    }

    if (boom_x < 1) {
        boom_x = 0;
    }
    if (boom_x > 84) {
        boom_x = 81;
    }
}