Yang Hongxiao 201199678
Dependencies: mbed
Obstacle.cpp
- Committer:
- YHX
- Date:
- 2020-05-14
- Revision:
- 1:a6ead8050c23
File content as of revision 1:a6ead8050c23:
#include "Obstacle.h" Obstacle::Obstacle(){ } Obstacle::~Obstacle(){ } void Obstacle::init(){ _x=20; _y=10; } void Obstacle::draw(N5110 &lcd){ lcd.drawRect(_x,_y,20,2,FILL_BLACK); } void Obstacle::new_obstacle(){ srand(time(NULL)); _x=rand()%(84-20); _y=rand()%(47-10); } Vector2D Obstacle::get_obstacle_pos() { Vector2D p = {_x,_y}; return p; }