bool canMove(OpenGL.Vector2 pos, Video.TileLayer collisionLayer) { int colliderWidth = 10, colliderHeight = 4; int newPosX = (int)pos.x; int newPosY = (int)pos.y; int colliderX = newPosX + character.sprite.rect.w / 2 - colliderWidth / 2; int colliderY = newPosY + 3 - colliderHeight / 2; //Check if we are colliding with something. bool colliding = false; if (collisionLayer != null) colliding = collisionLayer.intersects( new Util.Rect(colliderX, colliderY, colliderWidth, colliderHeight)); return !colliding; }