示例#1
0
        GameObjectTree makeGameObjectTree()
        {
            SpriteManager  m = SpriteManagerFactory.createSpriteManager(SpriteType.Alien, 0);
            GameObjectTree g = new GameObjectTree();
            Scale          a = SizeFactory.getFactory.alienScale;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 11; j++)
                {
                    GameObject temp = GameObjectFactory.createGameObject();
                    Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Crab);
                    m.createActive(s);
                    temp.setSprite(s);
                    temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                    temp.setScale(a.spriteWidth, a.spriteHeight);
                    temp.setColScale(a.colWidth, a.colHeight);
                    Alien t = new Alien(temp, ScoreReferenceFactory.getFactory.getScore(SpriteType.Crab));
                    PlayerModeStatusManagerFactory.getFactory.addObject(t);
                    g.AddToActive(j, i, t);
                }
            }
            for (int i = 2; i < 4; i++)
            {
                for (int j = 0; j < 11; j++)
                {
                    GameObject temp = GameObjectFactory.createGameObject();
                    Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Bug);
                    m.createActive(s);
                    temp.setSprite(s);
                    temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                    temp.setScale(a.spriteWidth, a.spriteHeight);
                    temp.setColScale(a.colWidth, a.colHeight);
                    Alien t = new Alien(temp, ScoreReferenceFactory.getFactory.getScore(SpriteType.Bug));
                    PlayerModeStatusManagerFactory.getFactory.addObject(t);
                    g.AddToActive(j, i, t);
                }
            }
            for (int i = 4; i < 5; i++)
            {
                for (int j = 0; j < 11; j++)
                {
                    GameObject temp = GameObjectFactory.createGameObject();
                    Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Squid);
                    m.createActive(s);
                    temp.setSprite(s);
                    temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                    temp.setScale(a.spriteWidth, a.spriteHeight);
                    temp.setColScale(a.colWidth, a.colHeight);
                    Alien t = new Alien(temp, ScoreReferenceFactory.getFactory.getScore(SpriteType.Squid));
                    PlayerModeStatusManagerFactory.getFactory.addObject(t);
                    g.AddToActive(j, i, t);
                }
            }
            return(g);
        }
示例#2
0
        public Projectile createPlayerProjectile()
        {
            GameObject           temp = GameObjectFactory.createGameObject();
            ProxyCollisionSprite t    = ProxySpriteCollisionFactory.proxy;

            t.setScale(SizeFactory.getFactory.playerP.colWidth, SizeFactory.getFactory.playerP.colHeight);
            temp.setCollisionSprite(t);
            Sprite s = ProxySpriteFactory.makeProxySprite(SpriteType.PlayerProjectile);

            temp.setSprite(s);
            spriteManager.createActive(s);
            temp.setScale(SizeFactory.getFactory.playerP.spriteWidth, SizeFactory.getFactory.playerP.spriteHeight);
            return(new Projectile(temp, MovementStateFactory.up));
        }
示例#3
0
        public Projectile createEnemyProjectile()
        {
            GameObject      temp   = GameObjectFactory.createGameObject();
            CollisionSprite sprite = ProxySpriteCollisionFactory.proxy;

            sprite.setScale(SizeFactory.getFactory.enemyP.colWidth, SizeFactory.getFactory.enemyP.colHeight);
            Sprite s = ProxySpriteFactory.makeProxySprite(SpriteType.EnemyProjectile);

            s.setScale(SizeFactory.getFactory.enemyP.spriteWidth, SizeFactory.getFactory.enemyP.spriteHeight);
            temp.setCollisionSprite(sprite);
            spriteManager.createActive(s);
            temp.setSprite(s);

            return(new Projectile(temp, MovementStateFactory.down));
        }
示例#4
0
        public GameObjectTreeFactory()
        {
            alien = makeGameObjectTree();

            SpriteManager m    = SpriteManagerFactory.createSpriteManager(SpriteType.Alien, 0);
            GameObject    temp = GameObjectFactory.createGameObject();
            Sprite        s    = ProxySpriteFactory.makeProxySprite(SpriteType.UFO);
            Scale         a    = SizeFactory.getFactory.alienScale;

            m.createActive(s);
            temp.setSprite(s);
            temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
            temp.setScale(a.spriteWidth, a.spriteHeight);
            temp.setColScale(a.colWidth, a.colHeight);
            ufo = new Alien(temp, 0);
            ufo.setStatus(Status.Inactive);
        }
示例#5
0
        public PlayerFactory()
        {
            GameObject tempGame = new GameObject();

            Sprite s = ProxySpriteFactory.makeProxySprite(SpriteType.Player);

            tempGame.setSprite(s);
            tempGame.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
            tempGame.setColScale(SizeFactory.getFactory.playerScale.colWidth, SizeFactory.getFactory.playerScale.colHeight);
            SpriteManager tempSpriteManager = SpriteManagerFactory.createSpriteManager(SpriteType.Player, 0);
            Scale         te = SizeFactory.getFactory.playerScale;

            tempGame.setColScale(te.colWidth, te.colHeight);
            tempGame.setScale(te.spriteWidth, te.spriteHeight);
            tempSpriteManager.createActive(s);

            player = new Player(tempGame);
            this.player.setSpriteScale(100, 100);
        }
示例#6
0
        public GameObjectTree makeGameObjectTreeShield()
        {
            SpriteManager  m = SpriteManagerFactory.createSpriteManager(SpriteType.Shield, 0);
            GameObjectTree g = new GameObjectTree();
            Scale          a = SizeFactory.getFactory.shieldScale;

            for (int i = 3; i < 11; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    GameObject temp = GameObjectFactory.createGameObject();
                    Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Shield);
                    m.createActive(s);
                    temp.setSprite(s);
                    temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                    temp.setScale(a.spriteWidth, a.spriteHeight);
                    temp.setColScale(a.colWidth, a.colHeight);
                    Shield t = new Shield(temp);
                    PlayerModeStatusManagerFactory.getFactory.addObject(t);
                    g.AddToActive(j, i, t);
                }
            }

            for (int j = 0; j < 3; j++)
            {
                GameObject temp = GameObjectFactory.createGameObject();
                Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Shield);
                m.createActive(s);
                temp.setSprite(s);
                temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                temp.setScale(a.spriteWidth, a.spriteHeight);
                temp.setColScale(a.colWidth, a.colHeight);
                Shield t = new Shield(temp);
                PlayerModeStatusManagerFactory.getFactory.addObject(t);
                g.AddToActive(j, 2, t);
            }
            for (int j = 5; j < 8; j++)
            {
                GameObject temp = GameObjectFactory.createGameObject();
                Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Shield);
                m.createActive(s);
                temp.setSprite(s);
                temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                temp.setScale(a.spriteWidth, a.spriteHeight);
                temp.setColScale(a.colWidth, a.colHeight);
                Shield t = new Shield(temp);
                PlayerModeStatusManagerFactory.getFactory.addObject(t);
                g.AddToActive(j, 2, t);
            }

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    GameObject temp = GameObjectFactory.createGameObject();
                    Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Shield);
                    m.createActive(s);
                    temp.setSprite(s);
                    temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                    temp.setScale(a.spriteWidth, a.spriteHeight);
                    temp.setColScale(a.colWidth, a.colHeight);
                    Shield t = new Shield(temp);
                    PlayerModeStatusManagerFactory.getFactory.addObject(t);
                    g.AddToActive(j, i, t);
                }
                for (int j = 6; j < 8; j++)
                {
                    GameObject temp = GameObjectFactory.createGameObject();
                    Sprite     s    = ProxySpriteFactory.makeProxySprite(SpriteType.Shield);
                    m.createActive(s);
                    temp.setSprite(s);
                    temp.setCollisionSprite(ProxySpriteCollisionFactory.proxy);
                    temp.setScale(a.spriteWidth, a.spriteHeight);
                    temp.setColScale(a.colWidth, a.colHeight);
                    Shield t = new Shield(temp);
                    PlayerModeStatusManagerFactory.getFactory.addObject(t);
                    g.AddToActive(j, i, t);
                }
            }
            return(g);
        }