Exemplo n.º 1
0
        public Vector2 updateRoom(Hero hero)
        {
            walls.UpdateWallCollisionWithHero(hero);
            XNACS1Base.EchoToTopStatus("num of enemy" + activeEnemies);
            for (int i = 0; i < myEnemies.Length; i++)
            {
                myEnemies[i].UpdateEnemy(hero, walls);
                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }
            //note to self: work on trigger
            if (XNACS1Base.GamePad.ButtonXClicked())
            {
                wand.Shoot(hero);
            }


            dropPos = wand.Update(myEnemies);
            if (dropPos.X > -1)
            {
                reduceActiveEnemies();
            }

            allDone = true;
            for (int i = 0; i < myEnemies.Length; i++)
            {
                if (!myEnemies[i].isBunny())
                {
                    allDone = false;
                }
            }


            if (key != null)
            {
                if (hero.Collided(key))
                {
                    openAllDoors();
                    key.RemoveFromAutoDrawSet();
                }

                if (myDoors[0].isOpen() && key != null)
                {
                    key.RemoveFromAutoDrawSet();
                }
            }
            Vector2 newRoom = new Vector2(-1f, -1f);

            for (int i = 0; i < numDoors; i++)
            {
                newRoom = myDoors[i].UpdateDoor(hero);

                if (newRoom.X > 0f)
                {
                    return(newRoom);
                }
            }

            return(newRoom);
        }
        public Vector2 updateRoom(Hero hero)
        {
            walls.UpdateWallCollisionWithHero(hero);

            for (int i = 0; i < myEnemies.Length; i++)
            {
                myEnemies[i].UpdateEnemy(hero, walls);
                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }
            //note to self: work on trigger
            if (XNACS1Base.GamePad.ButtonXClicked())
            {
                wand.Shoot(hero);
            }

            for (int i = 0; i < numEnemies; i++)
            {
                dropPos = wand.Update(myEnemies[i]);
                if (dropPos.X > -1)
                {
                    reduceActiveEnemies();
                }
            }

            if (key != null)
            {
                if (hero.Collided(key))
                {
                    openAllDoors();
                    key.RemoveFromAutoDrawSet();
                    key = null;
                }
            }
            Vector2 newRoom = new Vector2(-1f, -1f);

            for (int i = 0; i < numDoors; i++)
            {
                newRoom = myDoors[i].UpdateDoor(hero);

                if (newRoom.X > 0f)
                {
                    return(newRoom);
                }
            }

            return(newRoom);
        }
Exemplo n.º 3
0
        public Vector2 updateRoom(Hero hero, int levelNum)
        {
            heroCaught = false;
            walls.UpdateWallCollisionWithHero(hero);

            for (int i = 0; i < myEnemies.Length; i++)
            {
                bool temp = myEnemies[i].UpdateEnemy(hero, walls);
                if (temp)
                {
                    heroCaught = temp;
                }

                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }

            walls.updateStatus(hero, levelNum);
            if ((XNACS1Base.GamePad.Triggers.Right > 0 && !triggerPressed) || XNACS1Base.GamePad.ButtonXClicked())
            {
                wand.Shoot(hero);
                triggerPressed = true;
            }

            if (XNACS1Base.GamePad.Triggers.Right == 0)
            {
                triggerPressed = false;
            }

            dropPos = wand.Update(myEnemies, walls);
            if (dropPos.X > -1)
            {
                reduceActiveEnemies();
            }

            //allDone = true;
            //for (int i = 0; i < myEnemies.Length; i++) {
            //    if (!myEnemies[i].isBunny())
            //        allDone = false;

            //}

            if (hasStairs == 1 && badGuy != null)
            {
                walls.updateWizardStats(badGuy);
                hasWon = badGuy.Update(hero, wand);


                if (hasWon)
                {
                    stairs.AddToAutoDrawSet();
                    stairs.available = true;
                    openAllDoors();
                }

                if (badGuy.heroHit)
                {
                    heroCaught = true;
                }
            }

            if (key != null)
            {
                if (hero.Collided(key))
                {
                    openAllDoors();
                    XNACS1Base.PlayACue("door_open");
                    key.RemoveFromAutoDrawSet();
                }

                if (myDoors[0].isOpen() && key != null)
                {
                    key.RemoveFromAutoDrawSet();
                    key = null;
                }
            }
            Vector2 newRoom = new Vector2(-1f, -1f);

            for (int i = 0; i < numDoors; i++)
            {
                newRoom = myDoors[i].UpdateDoor(hero);

                if (newRoom.X > 0f)
                {
                    return(newRoom);
                }
            }

            return(newRoom);
        }
Exemplo n.º 4
0
        public bool Update(Hero hero, Wand w)
        {
            heroHit = false;
            health.Update(new Vector2(this.Center.X, this.Center.Y + 1), healthRemaining, initialLives);

            if (current == wizardStatus.isAlive)
            {
                if (shieldCoolDown < 0 && !shielded)
                {
                    shielded       = true;
                    shieldCoolDown = 100;
                }
                else
                {
                    shieldCoolDown--;
                }

                if (shieldCoolDown < 0 && shielded)
                {
                    shielded       = false;
                    shieldCoolDown = 100;
                }


                if (shielded)
                {
                    Texture = "wizardShield";
                }
                else
                {
                    Texture = "wizardRight";
                    if (coolDown < 0)
                    {
                        coolDown = 40;
                        shoot(hero.Center);
                    }
                    else
                    {
                        coolDown--;
                    }
                }

                for (int i = 0; i < list.Count; i++)
                {
                    shot temp = list[i];
                    if (list[i].shotLife == 0)
                    {
                        list[i].bullet.RemoveFromAutoDrawSet();
                        list[i].emitter.RemoveFromAutoDrawSet();
                        list.Remove(list[i]);
                    }
                    else
                    {
                        temp.shotLife--;
                        if (hero.Collided(temp.bullet) && !temp.hit)
                        {
                            hero.Caught();
                            hero.Center = hero.HeroInitialPos;
                            temp.hit    = true;
                            heroHit     = true;
                        }
                        list[i] = temp;
                        list[i].emitter.Center = list[i].bullet.Center;
                    }
                }
                for (int i = 0; i < w.list.Count; i++)
                {
                    if (w.list[i].bullet.Collided(this))
                    {
                        if (!shielded)
                        {
                            healthRemaining--;
                        }
                        else
                        {
                            Random r = new Random();
                            if (r.Next(0, 100) < 10)
                            {
                                healthRemaining--;
                            }
                        }
                    }
                }

                if (healthRemaining <= 0)
                {
                    current = wizardStatus.isDead;
                    Texture = "Newteddybear";
                    XNACS1Base.PlayACue("Bear-Sound");

                    return(true);
                }

                if (this.Center.X - hero.Center.X > 0)
                {
                    Texture = shielded ? "wizardShieldLeft" : "wizardLeft";
                }
                else
                {
                    Texture = shielded ? "wizardShield" : "wizardRight";
                }
            }

            if (current == wizardStatus.isDead)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    list[i].bullet.RemoveFromAutoDrawSet();
                    list[i].emitter.RemoveFromAutoDrawSet();
                    list.Remove(list[i]);
                }
            }
            return(false);
        }
Exemplo n.º 5
0
        public Vector2 updateRoom(Hero hero, int levelNum)
        {
            heroCaught = false;
            walls.UpdateWallCollisionWithHero(hero);

            for (int i = 0; i < myEnemies.Length; i++) {

                bool temp = myEnemies[i].UpdateEnemy(hero, walls);
                if (temp)
                    heroCaught = temp;

                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }

            walls.updateStatus(hero, levelNum);
            if ((XNACS1Base.GamePad.Triggers.Right > 0 && !triggerPressed) || XNACS1Base.GamePad.ButtonXClicked()) {
                wand.Shoot(hero);
                triggerPressed = true;
            }

            if (XNACS1Base.GamePad.Triggers.Right == 0) {
                triggerPressed = false;
            }

            dropPos = wand.Update(myEnemies, walls);
            if (dropPos.X > -1)
                reduceActiveEnemies();

            //allDone = true;
            //for (int i = 0; i < myEnemies.Length; i++) {
            //    if (!myEnemies[i].isBunny())
            //        allDone = false;

            //}

            if (hasStairs == 1 && badGuy != null) {
                walls.updateWizardStats(badGuy);
                hasWon = badGuy.Update(hero, wand);

                if (hasWon) {
                    stairs.AddToAutoDrawSet();
                    stairs.available = true;
                    openAllDoors();
                }

                if (badGuy.heroHit) {
                    heroCaught = true;
                }

            }

            if (key != null) {
                if (hero.Collided(key)) {
                    openAllDoors();
                    XNACS1Base.PlayACue("door_open");
                    key.RemoveFromAutoDrawSet();
                }

                if (myDoors[0].isOpen() && key != null) {
                    key.RemoveFromAutoDrawSet();
                    key = null;
                }
            }
            Vector2 newRoom = new Vector2(-1f, -1f);
            for (int i = 0; i < numDoors; i++) {

                newRoom = myDoors[i].UpdateDoor(hero);

                if (newRoom.X > 0f)
                    return newRoom;
            }

            return newRoom;
        }
Exemplo n.º 6
0
        public bool updateLevel(XNACS1Lib.XNACS1Lib.GamePadSupport.AllButtonsOnGamePad pad, 
			XNACS1Lib.XNACS1Lib.GamePadSupport.ThumbSticksOnGamePad thumbs, Hero hero)
        {
            Vector2 newRoom = new Vector2(-1, -1);
                if (rooms[(int)currentRoom.X, (int)currentRoom.Y].heroCaught || paused) {

                    if (ticker > 0) {
                        paused = true;
                        ticker--;
                    }

                    else {
                        paused = false;
                        rooms[(int)currentRoom.X, (int)currentRoom.Y].heroCaught = false;
                        ticker = 80;
                    }

                }

                else if (loads == loadState.notLoading) {
                    hero.UpdateHero(thumbs.Left);

                    newRoom = rooms[(int)currentRoom.X, (int)currentRoom.Y].updateRoom(hero, levelNum);
                    if (newRoom.X > -1) {
                        loads = loadState.loading;
                        if (newRoom.X > currentRoom.X)
                            currentDirection = loadDirection.right;

                        else if (newRoom.X < currentRoom.X)
                            currentDirection = loadDirection.left;

                        else if (newRoom.Y > currentRoom.Y)
                            currentDirection = loadDirection.top;

                        else
                            currentDirection = loadDirection.bottom;

                        lastVisitedRoom = currentRoom;
                        currentRoom = newRoom;
                        loadRoom(hero);

                        expectedOrigin = new Vector2(currentRoom.X * 100f, currentRoom.Y * ((9f / 16f) * 100f));

                    }
                }
            if (loads == loadState.loading) {
                hero.Visible = false;
                moveRoom();
            }

            if(loads == loadState.finished){
                hero.Visible = true;
                unLoadRoom();
                loads = loadState.notLoading;
                currentDirection = loadDirection.noDirection;
                currentOrigin = expectedOrigin;

            }

            if(rooms[(int)currentRoom.X, (int)currentRoom.Y].stairsInRoom()){
                if (hero.Collided(rooms[(int)currentRoom.X, (int)currentRoom.Y].stairs) && rooms[(int)currentRoom.X, (int)currentRoom.Y].stairs.available)
                    return true;
            }
            return false;
        }
        public Vector2 updateRoom(Hero hero)
        {
            walls.UpdateWallCollisionWithHero(hero);

            for (int i = 0; i < myEnemies.Length; i++) {
                myEnemies[i].UpdateEnemy(hero, walls);
                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }
            //note to self: work on trigger
            if (XNACS1Base.GamePad.ButtonXClicked())
                wand.Shoot(hero);

            for (int i = 0; i < numEnemies; i++) {
                dropPos = wand.Update(myEnemies[i]);
                if(dropPos.X > -1)
                    reduceActiveEnemies();

            }

            if (key != null)
                if (hero.Collided(key)) {
                    openAllDoors();
                    key.RemoveFromAutoDrawSet();
                    key = null;
                }
            Vector2 newRoom = new Vector2(-1f, -1f);
            for (int i = 0; i < numDoors; i++) {

                newRoom = myDoors[i].UpdateDoor(hero);

                if (newRoom.X > 0f)
                    return newRoom;
            }

            return newRoom;
        }
        public bool updateLevel(XNACS1Lib.XNACS1Lib.GamePadSupport.AllButtonsOnGamePad pad,
                                XNACS1Lib.XNACS1Lib.GamePadSupport.ThumbSticksOnGamePad thumbs)
        {
            Vector2 newRoom = new Vector2(-1, -1);

            if (loads == loadState.notLoading)
            {
                hero.UpdateHero(thumbs.Left);
                newRoom = rooms[(int)currentRoom.X, (int)currentRoom.Y].updateRoom(hero);
            }

            if (newRoom.X > -1)
            {
                loads = loadState.loading;
                if (newRoom.X > currentRoom.X)
                {
                    currentDirection = loadDirection.right;
                }

                else if (newRoom.X < currentRoom.X)
                {
                    currentDirection = loadDirection.left;
                }

                else if (newRoom.Y > currentRoom.Y)
                {
                    currentDirection = loadDirection.top;
                }

                else
                {
                    currentDirection = loadDirection.bottom;
                }

                lastVisitedRoom = currentRoom;
                currentRoom     = newRoom;
                loadRoom();

                expectedOrigin = new Vector2(currentRoom.X * 100f, currentRoom.Y * ((9f / 16f) * 100f));
            }

            if (loads == loadState.loading)
            {
                hero.Visible = false;
                moveRoom();
            }

            if (loads == loadState.finished)
            {
                hero.Visible = true;
                unLoadRoom();
                loads            = loadState.notLoading;
                currentDirection = loadDirection.noDirection;
                currentOrigin    = expectedOrigin;
            }


            //XNACS1Rectangle Screen;
            //if (hero.NumTimesCaught == 0)
            //{
            //    Screen = new XNACS1Rectangle(new Vector2(currentOrigin.X + 50f, currentOrigin.Y +25f), 100f, 54f);
            //    Screen.Label = "GAME OVER";
            //    Screen.LabelColor = Color.White;
            //    }
            //XNACS1Base.EchoToTopStatus("Hero has " + hero.NumTimesCaught + " live(s)");

            if (rooms[(int)currentRoom.X, (int)currentRoom.Y].stairsInRoom())
            {
                if (hero.Collided(rooms[(int)currentRoom.X, (int)currentRoom.Y].stairs))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 9
0
        public bool updateLevel(XNACS1Lib.XNACS1Lib.GamePadSupport.AllButtonsOnGamePad pad,
                                XNACS1Lib.XNACS1Lib.GamePadSupport.ThumbSticksOnGamePad thumbs, Hero hero)
        {
            Vector2 newRoom = new Vector2(-1, -1);

            if (rooms[(int)currentRoom.X, (int)currentRoom.Y].heroCaught || paused)
            {
                if (ticker > 0)
                {
                    paused = true;
                    ticker--;
                }

                else
                {
                    paused = false;
                    rooms[(int)currentRoom.X, (int)currentRoom.Y].heroCaught = false;
                    ticker = 80;
                }
            }

            else if (loads == loadState.notLoading)
            {
                hero.UpdateHero(thumbs.Left);



                newRoom = rooms[(int)currentRoom.X, (int)currentRoom.Y].updateRoom(hero, levelNum);
                if (newRoom.X > -1)
                {
                    loads = loadState.loading;
                    if (newRoom.X > currentRoom.X)
                    {
                        currentDirection = loadDirection.right;
                    }

                    else if (newRoom.X < currentRoom.X)
                    {
                        currentDirection = loadDirection.left;
                    }

                    else if (newRoom.Y > currentRoom.Y)
                    {
                        currentDirection = loadDirection.top;
                    }

                    else
                    {
                        currentDirection = loadDirection.bottom;
                    }

                    lastVisitedRoom = currentRoom;
                    currentRoom     = newRoom;
                    loadRoom(hero);

                    expectedOrigin = new Vector2(currentRoom.X * 100f, currentRoom.Y * ((9f / 16f) * 100f));
                }
            }
            if (loads == loadState.loading)
            {
                hero.Visible = false;
                moveRoom();
            }

            if (loads == loadState.finished)
            {
                hero.Visible = true;
                unLoadRoom();
                loads            = loadState.notLoading;
                currentDirection = loadDirection.noDirection;
                currentOrigin    = expectedOrigin;
            }

            if (rooms[(int)currentRoom.X, (int)currentRoom.Y].stairsInRoom())
            {
                if (hero.Collided(rooms[(int)currentRoom.X, (int)currentRoom.Y].stairs) && rooms[(int)currentRoom.X, (int)currentRoom.Y].stairs.available)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 10
0
        public bool Update(Hero hero, Wand w)
        {
            heroHit = false;
            health.Update(new Vector2(this.Center.X, this.Center.Y+1), healthRemaining, initialLives);

            if (current == wizardStatus.isAlive) {
                if (shieldCoolDown < 0 && !shielded) {
                    shielded = true;
                    shieldCoolDown = 100;
                }
                else
                    shieldCoolDown--;

                if (shieldCoolDown < 0 && shielded) {
                    shielded = false;
                    shieldCoolDown = 100;
                }

                if (shielded) {
                    Texture = "wizardShield";

                }
                else {
                    Texture = "wizardRight";
                    if (coolDown < 0) {
                        coolDown = 40;
                        shoot(hero.Center);
                    }
                    else
                        coolDown--;
                }

                for (int i = 0; i < list.Count; i++) {
                    shot temp = list[i];
                    if (list[i].shotLife == 0) {
                        list[i].bullet.RemoveFromAutoDrawSet();
                        list[i].emitter.RemoveFromAutoDrawSet();
                        list.Remove(list[i]);
                    }
                    else {
                        temp.shotLife--;
                        if (hero.Collided(temp.bullet) && !temp.hit) {
                            hero.Caught();
                            hero.Center = hero.HeroInitialPos;
                            temp.hit = true;
                            heroHit = true;
                        }
                        list[i] = temp;
                        list[i].emitter.Center = list[i].bullet.Center;
                    }
                }
                for (int i = 0; i < w.list.Count; i++)
                    if (w.list[i].bullet.Collided(this)) {
                        if (!shielded)
                            healthRemaining--;
                        else {
                            Random r = new Random();
                            if (r.Next(0, 100) < 10)
                                healthRemaining--;
                        }
                    }

                if (healthRemaining <= 0) {
                    current = wizardStatus.isDead;
                    Texture = "Newteddybear";
                    XNACS1Base.PlayACue("Bear-Sound");

                    return true;
                }

                if (this.Center.X - hero.Center.X > 0)
                    Texture = shielded ? "wizardShieldLeft" : "wizardLeft";
                else
                    Texture = shielded ? "wizardShield" : "wizardRight";
            }

            if (current == wizardStatus.isDead) {
                for (int i = 0; i < list.Count; i++) {
                    list[i].bullet.RemoveFromAutoDrawSet();
                    list[i].emitter.RemoveFromAutoDrawSet();
                    list.Remove(list[i]);
                }
            }
            return false;
        }
        public Vector2 updateRoom(Hero hero)
        {
            walls.UpdateWallCollisionWithHero(hero);
               XNACS1Base.EchoToTopStatus("num of enemy" + activeEnemies );
            for (int i = 0; i < myEnemies.Length; i++) {
                myEnemies[i].UpdateEnemy(hero, walls);
                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }
            //note to self: work on trigger
            if (XNACS1Base.GamePad.ButtonXClicked())
                wand.Shoot(hero);

            dropPos = wand.Update(myEnemies);
                if(dropPos.X > -1)
                    reduceActiveEnemies();

            allDone = true;
            for (int i = 0; i < myEnemies.Length; i++) {
                if (!myEnemies[i].isBunny())
                    allDone = false;

            }

            if (key != null)
            {
                if (hero.Collided(key))
                {
                    openAllDoors();
                    key.RemoveFromAutoDrawSet();
                }

                if(myDoors[0].isOpen() && key != null)
                    key.RemoveFromAutoDrawSet();
            }
            Vector2 newRoom = new Vector2(-1f, -1f);
            for (int i = 0; i < numDoors; i++) {

                newRoom = myDoors[i].UpdateDoor(hero);

                if (newRoom.X > 0f)
                    return newRoom;
            }

            return newRoom;
        }