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: Alien/Alien.cpp
- Revision:
- 6:5bea67cc96f9
- Child:
- 8:86cb9a9f8a73
diff -r e5bb95fb308b -r 5bea67cc96f9 Alien/Alien.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Alien/Alien.cpp Mon Mar 23 15:20:59 2020 +0000 @@ -0,0 +1,23 @@ +#include "Alien.h" + + +void Alien::init(int y, int size) { + X = WIDTH/2 - Size/2, + Y = y, + Size = size, + Speed = 0.2, +} + +void Alien::draw(N5110 &lcd) { + lcd.drawRect(X, Y, Size, Size, FILL_BLACK); +} + +Vector2D Alien::get_position() { + Vector2D p = {X,Y}; + return p; +} + +void Alien::update() { + X+=Speed; +} +