示例#1
0
        public Player(PlayerID _id)
        {
            lives = 4;
            id = _id;
            createLives(id);

            state = PlayerState.alive;

            emptySprite = (Sprite)DisplayManager.Instance().getDisplayObj(SpriteEnum.box);

            if (_id == PlayerID.one)
            {
                bombSprite = new Sprite(SpriteEnum.Bomb, 0, 0, 50, 50, true, 0,
                             ImageManager.Instance().getImage(ImageEnum.bluebomb1), false);
                missileType = GameObjType.p1missiles;
            }
            else
            {
                bombSprite = new Sprite(SpriteEnum.Bomb, 0, 0, 50, 50, true, 0,
                             ImageManager.Instance().getImage(ImageEnum.greenbomb1), false);
                missileType = GameObjType.p2missiles;
            }

            bombSpriteIndex = 5;
            numMissiles = 0;
        }
示例#2
0
 public Animation(Sprite _sprite)
 {
     sprite = _sprite;
     numImages = 0;
     curImage = 0;
     head = new ImageLink(sprite.image);
     current = head;
 }
示例#3
0
 public void changeSprite(Sprite _sprite)
 {
     sprite = _sprite;
 }
示例#4
0
        private void createP2Lives()
        {
            Sprite shipSprite = (Sprite)DisplayManager.Instance().getDisplayObj(SpriteEnum.Ship);

            Sprite_Proxy pShip1 = new Sprite_Proxy(shipSprite, 175, 85, 0.4f, Color.Chartreuse);
            Sprite_Proxy pShip2 = new Sprite_Proxy(shipSprite, 190, 85, 0.4f, Color.Chartreuse);
            Sprite_Proxy pShip3 = new Sprite_Proxy(shipSprite, 205, 85, 0.4f, Color.Chartreuse);

            pShip1.rotation = -(float)(90.0f * (Math.PI / 180.0f));
            pShip2.rotation = -(float)(90.0f * (Math.PI / 180.0f));
            pShip3.rotation = -(float)(90.0f * (Math.PI / 180.0f));

            SBNode shipBatch = SpriteBatchManager.Instance().getBatch(batchEnum.ships);

            shipBatch.addDisplayObject(pShip1);
            shipBatch.addDisplayObject(pShip2);
            shipBatch.addDisplayObject(pShip3);

            lifeSprite1 = pShip1;
            lifeSprite2 = pShip2;
            lifeSprite3 = pShip3;

            color = Color.Chartreuse;

            // Bomb Sprites
            Sprite bSprite1 = new Sprite(SpriteEnum.Bomb, 0, 0, 50, 50, true, 0,
                         ImageManager.Instance().getImage(ImageEnum.greenbomb1), false);

            Sprite_Proxy pBomb1 = new Sprite_Proxy(bSprite1, 175, 95, 0.5f, Color.Chartreuse);
            Sprite_Proxy pBomb2 = new Sprite_Proxy(bSprite1, 183, 95, 0.5f, Color.Chartreuse);
            Sprite_Proxy pBomb3 = new Sprite_Proxy(bSprite1, 191, 95, 0.5f, Color.Chartreuse);
            Sprite_Proxy pBomb4 = new Sprite_Proxy(bSprite1, 199, 95, 0.5f, Color.Chartreuse);
            Sprite_Proxy pBomb5 = new Sprite_Proxy(bSprite1, 207, 95, 0.5f, Color.Chartreuse);

            SBNode bombBatch = SpriteBatchManager.Instance().getBatch(batchEnum.bomb);

            bombBatch.addDisplayObject(pBomb1);
            bombBatch.addDisplayObject(pBomb2);
            bombBatch.addDisplayObject(pBomb3);
            bombBatch.addDisplayObject(pBomb4);
            bombBatch.addDisplayObject(pBomb5);

            bombSprite1 = pBomb1;
            bombSprite2 = pBomb2;
            bombSprite3 = pBomb3;
            bombSprite4 = pBomb4;
            bombSprite5 = pBomb5;
        }