Mohsin Riaz / Mbed 2 deprecated Pong-MiP

Dependencies:   mbed tsi_sensor

source/pala.h

Committer:
immou
Date:
2020-05-17
Revision:
1:2c86b5fb793a
Child:
2:292e47672dbe

File content as of revision 1:2c86b5fb793a:

#ifndef PALA_H_
#define PALA_H_

#include <iostream>
#include "../globals.h"

using namespace std;

class Pala
{
public:
    int x,y,w,h;
    Pala(int x, int y, int w, int h) : x(x), y(y), w(w), h(h)
    {
        reset();
    };
    ~Pala();
    void reset();
    void moveUp();
    void moveDown();
    void moveAuto(int bolapos);
};

void Pala::reset()
{
    y = (MAP_HEIGHT / 2) - h/2;
}

void Pala::moveDown()
{
    if(y > 1)
        y -= 5;
};
void Pala::moveUp()
{
    if(y + h < MAP_HEIGHT)
        y += 5;
};

#endif