Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GameObject.cpp Source File

GameObject.cpp

00001 #include "GameObject.h"
00002 
00003 StaticGameObject::StaticGameObject()
00004 {
00005 }
00006 
00007 StaticGameObject::~StaticGameObject()
00008 {
00009 }
00010 
00011 const Vector2D& StaticGameObject::getPos() const
00012 {
00013     return pos; // Returns the x and y position of an object 
00014 }
00015 
00016 void StaticGameObject::move()
00017 {
00018 }
00019 
00020 void StaticGameObject::draw(N5110 &lcd)
00021 {
00022     lcd.drawRect(pos.x,pos.y,w,h,FILL_BLACK); // Draws each object using the LCD class 
00023 }
00024 
00025 void GameObject::move()
00026 {
00027     pos.x += velocity.x; // Adds the velocity to the current x-position 
00028     pos.y += velocity.y; // Adds the velocity to the current y-position 
00029 }