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
Wall/Wall.cpp
- Committer:
- ml16c5l
- Date:
- 2019-04-28
- Revision:
- 9:192ad897ec95
- Parent:
- 8:ccf827ce0072
- Child:
- 10:bb273261d33d
File content as of revision 9:192ad897ec95:
 /*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name: Caiwenjing Liu
Username:ml16c5l
Student ID Number: 201165261
Date: 11/04/2019
*/
 
 #include "Wall.h"
Wall::Wall(){
}
Wall::~Wall(){
}
void Wall::init(int size,int speed)
{
    _size = size;
    _x =0;  
    _y =0 ;
    _velocity.x = speed;
    _velocity.y = speed;
}
void Wall::draw(N5110 &lcd)
{
 lcd.drawRect(_x,_y,1,_y+10,FILL_BLACK);
    
    /*lcd.drawRect(_x,_y,_x+5,_y+10,FILL_BLACK);
    lcd.drawRect(_x+10,_y+33,_x+15,_y+40,FILL_BLACK);*/
    
 
   
  
}
void Wall::update()
{
  
    _x -= _velocity.x;
    if (_x <= 1){
        _x = WIDTH;
        _y = _y;
        }
}
void Wall::set_velocity(Vector2D v)
{
    _velocity.x = v.x;
    _velocity.y = v.y;
}
Vector2D Wall::get_velocity()
{
    Vector2D v = {_velocity.x,_velocity.y};
    return v;
}
Vector2D Wall::get_pos()
{
    Vector2D p = {_x,_y};
    return p;
}
void Wall::set_pos(Vector2D p)
{
    _x = p.x;
    _y = p.y;
}