I am learning OOP using c++ on a MicroBit by developing this simple game
gameEngine/source/game.cpp
- Committer:
- ahmeou
- Date:
- 2020-07-08
- Revision:
- 0:17bdfb0e7069
- Child:
- 1:25f13b341b11
File content as of revision 0:17bdfb0e7069:
#include "game.h" Sprite::Sprite(){ setX(0); setY(0); } Sprite::Sprite(int x, int y){ setX(x); setY(y); } void Sprite::setX(int x){ m_x = x; } void Sprite::setY(int y){ m_y = y; } int Sprite::getX(){ return m_x; } int Sprite::getY(){ return m_y; } bool Sprite::hitBy(Sprite another){ return m_x == another.getX() && m_y == another.getY(); }