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 4DGL-uLCD-SE SDFileSystem PinDetect
Diff: lame.h
- Revision:
- 5:cf8ae4ca6f2b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lame.h Mon Apr 25 01:52:31 2022 +0000
@@ -0,0 +1,83 @@
+#ifndef LAME_H
+#define LAME_H
+
+//This is my base class!
+class ScreenObject {
+public:
+ virtual void draw(uLCD_4DGL&) = 0; //pure virtual
+ virtual void update(uLCD_4DGL&) = 0; //pure virtual
+ void clearScreen(uLCD_4DGL&);
+ void changexPos(int);
+ void setxPosition(int);
+ void setyPosition(int);
+ void setDirec(bool);
+ void setHit(bool);
+ bool getHit();
+ int getxPosition();
+ int getyPosition();
+private:
+ int xPosition;
+ int yPosition;
+ bool direction;
+ bool hit;
+};
+
+//This is my ship class that inherits from my base class
+class Ship : public ScreenObject {
+public:
+ Ship();
+ void draw(uLCD_4DGL&);
+ void update(uLCD_4DGL&);
+ void moveRight();
+ void moveLeft();
+};
+
+//Bullet class with inheritance
+class Bullet : public ScreenObject {
+public:
+ Bullet();
+ void draw(uLCD_4DGL&);
+ void update(uLCD_4DGL&);
+ void fireBullet(Ship&, uLCD_4DGL&);
+ void setBullet(bool);
+ bool getBullet();
+ int getxBullet();
+ int getyBullet();
+ bool hitTest(ScreenObject&);
+private:
+ bool oneBullet;
+};
+
+//Alien alice be inheriting
+class AlienAlice : public ScreenObject {
+public:
+ AlienAlice(int);
+ void draw(uLCD_4DGL&);
+ void update(uLCD_4DGL&);
+};
+
+//Same with alien bob
+class AlienBob : public ScreenObject {
+public:
+ AlienBob(int);
+ void draw(uLCD_4DGL&);
+ void update(uLCD_4DGL&);
+};
+
+//Cant forget alien jeff
+class AlienJeff : public ScreenObject {
+public:
+ AlienJeff(int);
+ void draw(uLCD_4DGL&);
+ void update(uLCD_4DGL&);
+};
+
+//Finally alien Mike is inheriting stuff
+class AlienMike : public ScreenObject {
+public:
+ AlienMike(int);
+ void draw(uLCD_4DGL&);
+ void update(uLCD_4DGL&);
+};
+
+#endif
\ No newline at end of file