Exemple #1
0
        public static Ship ActivateShip()
        {
            //ensure call Create() first
            ShipMan pShipMan = ShipMan.GetInstance();

            Debug.Assert(pShipMan != null);

            // create ship
            Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 440, 90);

            pShipMan.pShip = pShip;

            // attach sprite to correct sprite batch
            SpriteBatch pSB_Ships = SpriteBatchMan.Find(SpriteBatch.Name.Ships);

            pSB_Ships.attach(pShip.getProxySprite());

            // attach ship to ship group
            GameObject pShipGroup = GameObjectMan.Find(GameObject.Name.ShipGroup);

            Debug.Assert(pShipGroup != null);

            // add to GameObject
            pShipGroup.add(pShipMan.pShip);
            pShip.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes));

            return(pShipMan.pShip);
        }
Exemple #2
0
        public void createLifes()
        {
            this.pLifeGroup = (ShipLifeGroup)GameObjectMan.Find(GameObject.Name.ShipLifeGroup);
            SpriteBatch pSB_Lifes = SpriteBatchMan.Find(SpriteBatch.Name.Lifes);
            SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes);

            Ship  pShip;
            float startX = 40.0f;
            float startY = 30.0f;
            float gap    = 60.0f;

            for (int i = 0; i < this.lifeRemain; i++)
            {
                pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, startX, startY);
                pShip.activateGameSprite(pSB_Lifes);
                pShip.activateCollisionSprite(pSB_Boxes);
                this.pLifeGroup.add(pShip);
                startX += gap;
            }
        }