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
Fork of ll14zs by
Diff: Car/Car.cpp
- Revision:
- 3:1231a3961984
- Parent:
- 2:5d3aac7fd3df
--- a/Car/Car.cpp Tue May 08 11:15:58 2018 +0000 +++ b/Car/Car.cpp Thu May 24 17:37:17 2018 +0000 @@ -3,28 +3,31 @@ Car::Car() { + } Car::~Car() { + } void Car::init(int x,int y,int width, int height) { - _x = WIDTH/2; _width = 3; // x initial start coordinate - _y = HEIGHT/3; _height = 5; // y initial start coordinate + _x = WIDTH/2; _width = 3; // initial start coordinate (x) + _y = HEIGHT/3; _height = 5; // initial start coordinate (y) int direction = 0; if (direction == 0) { - _velocity.y = (1);// car is always moving + _velocity.y = (1);// car is moving in the y direction, hence, down the screen } } void Car::draw(N5110 &lcd) { - // draw in screen buffer. + // the pixels in the screen are filled in black to form a rectangle + lcd.drawRect(_x,_y,_width,_height,FILL_BLACK); } @@ -78,13 +81,13 @@ } -Vector2D Car::get_position() +Vector2D Car::get_pos() { Vector2D p = {_x,_y}; return p; } -void Car::set_position(Vector2D p) +void Car::set_pos(Vector2D p) { _x = p.x; _y = p.y; @@ -99,4 +102,4 @@ int Car::get_score() { return _score; -} +} \ No newline at end of file