Пример #1
0
        public void repositionSprite(float dt)
        {
            CCPoint p   = m_tamara.positionInPixels;
            CCNode  map = getChildByTag(1);

            // there are only 4 layers. (grass and 3 trees layers)
            // if tamara < 48, z=4
            // if tamara < 96, z=3
            // if tamara < 144,z=2

            int newZ = 4 - (int)(p.y / 48);

            newZ = Math.Max(newZ, 0);

            map.reorderChild(m_tamara, newZ);
        }
Пример #2
0
        //¸´Î»
        void repositionSprite(float dt)
        {
            CCPoint p   = m_tamara.positionInPixels;
            CCNode  map = getChildByTag(1);

            // there are only 4 layers. (grass and 3 trees layers)
            // if tamara < 81, z=4
            // if tamara < 162, z=3
            // if tamara < 243,z=2

            // -10: customization for this particular sample
            int newZ = 4 - (int)((p.y - 10) / 81);

            newZ = Math.Max(newZ, 0);

            map.reorderChild(m_tamara, newZ);
        }