Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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;
}
}