Josh Davy / Mbed 2 deprecated Flip

Dependencies:   mbed el17jd

Committer:
joshdavy
Date:
Tue Apr 02 12:40:31 2019 +0000
Revision:
3:b34685dbdb8d
Parent:
2:b62e8be35a5d
Child:
4:afbf3dd71403
Moved player to its own inherited class to allow sprite to serve multiple puporses

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joshdavy 1:37802772843e 1 #include "Sprite.h"
joshdavy 1:37802772843e 2
joshdavy 1:37802772843e 3
joshdavy 1:37802772843e 4
joshdavy 1:37802772843e 5 Sprite::Sprite()
joshdavy 1:37802772843e 6 {
joshdavy 1:37802772843e 7
joshdavy 1:37802772843e 8 }
joshdavy 1:37802772843e 9
joshdavy 1:37802772843e 10 Sprite::~Sprite()
joshdavy 1:37802772843e 11 {
joshdavy 1:37802772843e 12
joshdavy 1:37802772843e 13 }
joshdavy 1:37802772843e 14
joshdavy 1:37802772843e 15 void Sprite::init(int height,int width,int * bitmap,Vector2D pos)
joshdavy 1:37802772843e 16 {
joshdavy 1:37802772843e 17 _height = height;
joshdavy 1:37802772843e 18 _width = width;
joshdavy 1:37802772843e 19 _bitmap = bitmap;
joshdavy 1:37802772843e 20 _pos = pos;
joshdavy 1:37802772843e 21 }
joshdavy 1:37802772843e 22
joshdavy 3:b34685dbdb8d 23 void Sprite::update()
joshdavy 2:b62e8be35a5d 24 {
joshdavy 3:b34685dbdb8d 25 _pos.y += GRAVITY;
joshdavy 2:b62e8be35a5d 26 }
joshdavy 1:37802772843e 27
joshdavy 2:b62e8be35a5d 28 void Sprite::render(N5110 &lcd) {
joshdavy 2:b62e8be35a5d 29
joshdavy 1:37802772843e 30 lcd.drawSprite(_pos.x,_pos.y,_height,_width, _bitmap);
joshdavy 1:37802772843e 31 };
joshdavy 1:37802772843e 32
joshdavy 1:37802772843e 33 Vector2D Sprite::getPos() {
joshdavy 1:37802772843e 34 return _pos;
joshdavy 1:37802772843e 35 };
joshdavy 1:37802772843e 36
joshdavy 1:37802772843e 37 void Sprite::setPos(Vector2D pos) {
joshdavy 1:37802772843e 38 _pos = pos;
joshdavy 1:37802772843e 39 };
joshdavy 1:37802772843e 40
joshdavy 1:37802772843e 41