runner

Dependencies:   mbed

Committer:
kamtas
Date:
Thu May 09 14:58:01 2019 +0000
Revision:
6:ee273baff27c
Parent:
4:7fca66882a00
Child:
9:61c4ec74a71f
done

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kamtas 3:59e67155e2dd 1 #ifndef OBSTACLE_H
kamtas 3:59e67155e2dd 2 #define OBSTACLE_H
kamtas 3:59e67155e2dd 3
kamtas 3:59e67155e2dd 4 #include "mbed.h"
kamtas 3:59e67155e2dd 5 #include "N5110.h"
kamtas 3:59e67155e2dd 6 #include "Gamepad.h"
kamtas 3:59e67155e2dd 7
kamtas 6:ee273baff27c 8 /* Obstacle class
kamtas 6:ee273baff27c 9 * @brief initialises the obstacle and tells it how to behave
kamtas 6:ee273baff27c 10 * @author Kamil Zabraniak
kamtas 6:ee273baff27c 11 * @date May,2019
kamtas 6:ee273baff27c 12 */
kamtas 3:59e67155e2dd 13 class Obstacle
kamtas 3:59e67155e2dd 14 {
kamtas 3:59e67155e2dd 15 public:
kamtas 3:59e67155e2dd 16
kamtas 6:ee273baff27c 17 /** constructor */
kamtas 3:59e67155e2dd 18 Obstacle();
kamtas 6:ee273baff27c 19 /** deconstructor */
kamtas 3:59e67155e2dd 20 ~Obstacle();
kamtas 6:ee273baff27c 21 /**initialise obstacle
kamtas 6:ee273baff27c 22 * @param position y which is always fixed (int)
kamtas 6:ee273baff27c 23 * @param obstacle height (int)
kamtas 6:ee273baff27c 24 * @param obstacle width (int)
kamtas 6:ee273baff27c 25 */
kamtas 3:59e67155e2dd 26 void init(int y,int height,int width);
kamtas 6:ee273baff27c 27 /** renders the obstacle on the lcd
kamtas 6:ee273baff27c 28 * @param lcd command to draw a rectangle (N5110)
kamtas 6:ee273baff27c 29 */
kamtas 3:59e67155e2dd 30 void draw(N5110 &lcd);
kamtas 6:ee273baff27c 31 /** update the obstacle's position
kamtas 6:ee273baff27c 32 * @param value of ran which is currently set to always true (bool)
kamtas 6:ee273baff27c 33 */
kamtas 4:7fca66882a00 34 void update(bool ran);
kamtas 6:ee273baff27c 35 /** gets the current position of the obstacle
kamtas 6:ee273baff27c 36 * @param return p which contain the values of _x and _y of the obstacle (Vector2D)
kamtas 6:ee273baff27c 37 */
kamtas 3:59e67155e2dd 38 Vector2D get_pos();
kamtas 3:59e67155e2dd 39
kamtas 3:59e67155e2dd 40 private:
kamtas 3:59e67155e2dd 41
kamtas 3:59e67155e2dd 42 int _height;
kamtas 3:59e67155e2dd 43 int _width;
kamtas 3:59e67155e2dd 44 int _x;
kamtas 3:59e67155e2dd 45 int _y;
kamtas 3:59e67155e2dd 46 int _speed;
kamtas 3:59e67155e2dd 47
kamtas 3:59e67155e2dd 48 };
kamtas 3:59e67155e2dd 49 #endif