コード例 #1
0
        public SpriteSubclass()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFramesWithFile("animations/ghosts");
            CCSpriteBatchNode aParent = CCSpriteBatchNode.batchNodeWithFile("animations/images/ghosts");

            // MySprite1
            MySprite1 sprite = MySprite1.spriteWithSpriteFrameName("father.gif");

            sprite.position = (new CCPoint(s.width / 4 * 1, s.height / 2));
            aParent.addChild(sprite);
            addChild(aParent);

            // MySprite2
            MySprite2 sprite2 = MySprite2.spriteWithFile("Images/grossini");

            addChild(sprite2);
            sprite2.position = (new CCPoint(s.width / 4 * 3, s.height / 2));
        }