]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/Entity.cpp
check tile lock in Entity
[l2e.git] / src / map / Entity.cpp
index 01cbe7f619e8b37aaf20ee051c72e038837a27a7..c14c9a0e7321a25b43e5fa64875545c3be974dd5 100644 (file)
@@ -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<int> 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<int> &offset) const {
+void Entity::Render(SDL_Surface *dest, const Vector<int> &offset) const {
        if (animation.Running()) {
                animation.DrawCenterBottom(dest, offset + position);
        } else {