public void loadInitialRoom(int difficulty)
        {
            XNACS1Base.World.SetWorldCoordinate
                (new Vector2(initialRoom.X * 100f, initialRoom.Y * (9f / 16f) * 100f), 100f);
            //XNACS1Base.World.SetBackgroundTexture("bg1");

            hero = new Hero(new Vector2(rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().X
                                        + 50f, rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().Y + (9f / 16f) * 50f), difficulty);
            rooms[(int)initialRoom.X, (int)initialRoom.Y].loadRoom();
            currentRoom      = initialRoom;
            lastVisitedRoom  = currentRoom;
            currentOrigin    = new Vector2(currentRoom.X * 100f, currentRoom.Y * (9f / 16f) * 100f);
            loads            = loadState.notLoading;
            currentDirection = loadDirection.noDirection;
        }
コード例 #2
0
        public void loadInitialRoom(int difficulty, Hero hero)
        {
            XNACS1Base.World.SetWorldCoordinate
                (new Vector2(initialRoom.X * 100f, initialRoom.Y * (9f / 16f) * 100f), 100f);


            hero.Center = new Vector2(rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().X
                                      + 50f, rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().Y + (9f / 16f) * 50f);

            rooms[(int)initialRoom.X, (int)initialRoom.Y].loadRoom(hero, levelNum);
            roomMap[(int)initialRoom.X, (int)initialRoom.Y] = roomState.visited; // betania added
            currentRoom      = initialRoom;
            lastVisitedRoom  = currentRoom;
            currentOrigin    = new Vector2(currentRoom.X * 100f, currentRoom.Y * (9f / 16f) * 100f);
            loads            = loadState.notLoading;
            currentDirection = loadDirection.noDirection;
            hero.TopOfAutoDrawSet();
        }
コード例 #3
0
ファイル: Level.cs プロジェクト: abflin2/Princess_Penny_Game
        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;
        }
コード例 #4
0
ファイル: Level.cs プロジェクト: abflin2/Princess_Penny_Game
        public void loadInitialRoom(int difficulty, Hero hero)
        {
            XNACS1Base.World.SetWorldCoordinate
                (new Vector2(initialRoom.X * 100f, initialRoom.Y * (9f/16f)*100f), 100f);

            hero.Center = new Vector2(rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().X
                + 50f, rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().Y + (9f / 16f) * 50f);

            rooms[(int)initialRoom.X, (int)initialRoom.Y].loadRoom(hero, levelNum);
            roomMap[(int)initialRoom.X, (int)initialRoom.Y] = roomState.visited; // betania added
            currentRoom = initialRoom;
            lastVisitedRoom = currentRoom;
            currentOrigin = new Vector2(currentRoom.X * 100f, currentRoom.Y * (9f / 16f) * 100f);
            loads = loadState.notLoading;
            currentDirection = loadDirection.noDirection;
            hero.TopOfAutoDrawSet();
        }
        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);
        }
コード例 #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 void loadInitialRoom(int difficulty)
        {
            XNACS1Base.World.SetWorldCoordinate
                (new Vector2(initialRoom.X * 100f, initialRoom.Y * (9f/16f)*100f), 100f);
            //XNACS1Base.World.SetBackgroundTexture("bg1");

            hero = new Hero(new Vector2(rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().X
                + 50f, rooms[(int)initialRoom.X, (int)initialRoom.Y].roomOrig().Y + (9f / 16f) * 50f), difficulty);
            rooms[(int)initialRoom.X, (int)initialRoom.Y].loadRoom();
            currentRoom = initialRoom;
            lastVisitedRoom = currentRoom;
            currentOrigin = new Vector2(currentRoom.X * 100f, currentRoom.Y * (9f / 16f) * 100f);
            loads = loadState.notLoading;
            currentDirection = loadDirection.noDirection;
        }
        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;
        }