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
Diff: boom/boom.cpp
- Revision:
- 3:1a134243e2f0
- Child:
- 4:55d904040636
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/boom/boom.cpp Sun Apr 15 17:36:29 2018 +0000
@@ -0,0 +1,52 @@
+#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;
+ }
+}
+
+