X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FEntity.cpp;fp=src%2Fmap%2FEntity.cpp;h=c14c9a0e7321a25b43e5fa64875545c3be974dd5;hb=657eed00ae73b8d06470cec0d955aeada537a90d;hp=01cbe7f619e8b37aaf20ee051c72e038837a27a7;hpb=56b6adfe5cf27293ee40b43502142e0690d8293b;p=l2e.git diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index 01cbe7f..c14c9a0 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -7,6 +7,8 @@ #include "Entity.h" +using geometry::Vector; + namespace map { Entity::Entity() @@ -15,12 +17,20 @@ Entity::Entity() } +bool Entity::TileLock(int width, int height) const { + Vector tilePosition( + position.X() - (width / 2), + position.Y() - height); + return (tilePosition.X() % width == 0) && (tilePosition.Y() % height == 0); +} + + void Entity::Update(float deltaT) { position += velocity * deltaT; } -void Entity::Render(SDL_Surface *dest, const geometry::Vector &offset) const { +void Entity::Render(SDL_Surface *dest, const Vector &offset) const { if (animation.Running()) { animation.DrawCenterBottom(dest, offset + position); } else {