Пример #1
0
        public bool collide(LLESprite target, float offsetX, float offsetY)
        {
            if(target != null)
            {
                float targetX = target.getX();

                float targetY = target.getY();

                float targetW = target.getWidth();

                float targetH = target.getHeight();

                int theWidth = mW;

                if (mAnimating)
                {
                    theWidth = getFrameWidth();
                }

                if (mX + theWidth >= targetX + offsetX && mX <= targetX + targetW - offsetX &&

                   mY + mH >= targetY + offsetY && mY <= targetY + targetH - offsetY)
                {
                    return true;
                }
            }

            return false;
        }