Example #1
0
        public Vector2 getPlayerPosition()
        {
            BaseScreen currentScreen = Game1.getInstance().getScreenManager().getCurrentScreen();

            if (currentScreen is GamePlayScreen)
            {
                return(((GamePlayScreen)currentScreen).getPlayerLocation());
            }

            return(new Vector2());
        }
Example #2
0
        public float getPlayerCenter()
        {
            BaseScreen currentScreen = Game1.getInstance().getScreenManager().getCurrentScreen();

            if (currentScreen is GamePlayScreen)
            {
                return(((GamePlayScreen)currentScreen).getPlayerCenter());
            }

            return(0f);
        }
Example #3
0
 public Fade(BaseScreen context, String fadeImagePath, SPEED speedType) : this(context, fadeImagePath)
 {
     if (speedType == SPEED.SLOW)
     {
         mSpeed = 0.01f;
     }
     if (speedType == SPEED.MEDIUM)
     {
         mSpeed = 0.02f;
     }
     if (speedType == SPEED.FAST)
     {
         mSpeed = 0.08f;
     }
     if (speedType == SPEED.ULTRAFAST)
     {
         mSpeed = 0.12f;
     }
 }
Example #4
0
        public override void update(GameTime gameTime)
        {
            float      distance;
            BaseScreen currentScreen  = Game1.getInstance().getScreenManager().getCurrentScreen();
            Vector2    playerPosition = ((GamePlayScreen)currentScreen).getPlayerCenterVector();

            Vector2.Distance(ref playerPosition, ref spritePos, out distance);
            //Console.WriteLine(distance);
            if (distance > 15)
            {
                pos = oldPosition;
                //altere aqui para fazer a onda do seno mais rapidamente/devagarmente :p
                x += 0.1f;

                destAngle = Math.Atan2(playerPosition.Y - pos.Y, playerPosition.X - pos.X);
                if (destAngle < 0)
                {
                    destAngle = posAngle;
                }
                else
                {
                    posAngle = destAngle;
                }

                //altere "1.0f" para fazer com que ele se desloque mais rapidamente
                pos.X += 1.2f * (float)Math.Cos(destAngle);
                pos.Y += 1.2f * (float)Math.Sin(destAngle);

                Vector2 direction = playerPosition - oldPosition;

                Vector2 perpendicular = new Vector2(direction.Y, -direction.X);
                perpendicular.Normalize();

                //faz um seno de "75 pixels"
                float offset = 75.0f * (float)Math.Sin(x);

                spritePos   = pos + (offset * perpendicular);
                oldPosition = pos;
            }
            else
            {
                //Console.WriteLine("colidiu");
            }


            //PLAYER IS LEFT FROM CRAB
            if (getPlayerCenter() < getCenterX())
            {
                //getCurrentSprite().setFlip(true);
                setFlip(true);
            }
            else
            {
                //getCurrentSprite().setFlip(false);
                setFlip(false);
            }

            setLocation(spritePos);

            base.update(gameTime);//getCurrentSprite().update();
            //LOGICA
        }
Example #5
0
        private void processButtonAction(Button button)
        {
            if (button == mButtonPlay)
            {
                SoundManager.PlaySound(cSOUND_HIGHLIGHT);
                mFade = new Fade(this, "fades\\blackfade");
                //
                //TODO if.....
                //ObjectSerialization.Save<ProgressObject>(Game1.sPROGRESS_FILE_NAME, new ProgressObject(1, ProgressObject.PlayerColor.GREEN));

                Game1.progressObject = ExtraFunctions.loadProgress();

                if (Game1.progressObject != null)
                {
                    if (Game1.progressObject.getCurrentStage() > 1)
                    {
                        configureToContinueScreen(true);
                    }
                    else
                    {
                        //SoundManager.stopMusic();

                        ObjectSerialization.Save <ProgressObject>(Game1.sPROGRESS_FILE_NAME, Game1.progressObject.setStageAndColor(1, ProgressObject.PlayerColor.BLUE));
                        executeFade(mFade, Fade.sFADE_OUT_EFFECT_GRADATIVE);
                        mFadeParam = FADE_PARAM.START_GAME;
                    }
                }

                /*
                 */
            }
            else
            if (button == mButtonContinue)
            {
                //SoundManager.PlaySound(cSOUND_HIGHLIGHT);
                //mFade = new Fade(this, "fades\\blackfade");
                //executeFade(mFade, Fade.sFADE_OUT_EFFECT_GRADATIVE);

                SoundManager.PlaySound(cSOUND_HIGHLIGHT);
                executeFade(mFade, Fade.sFADE_OUT_EFFECT_GRADATIVE);
                mFadeParam = FADE_PARAM.CONTINUE_GAME;
            }
            else
            if (button == mButtonNewGame)
            {
                //SoundManager.PlaySound(cSOUND_HIGHLIGHT);
                //mFade = new Fade(this, "fades\\blackfade");
                //executeFade(mFade, Fade.sFADE_OUT_EFFECT_GRADATIVE);
                SoundManager.PlaySound(cSOUND_HIGHLIGHT);

                ObjectSerialization.Save <ProgressObject>(Game1.sPROGRESS_FILE_NAME, Game1.progressObject.setStageAndColor(1, ProgressObject.PlayerColor.BLUE));
                executeFade(mFade, Fade.sFADE_OUT_EFFECT_GRADATIVE);
                mFadeParam = FADE_PARAM.START_GAME;
            }
            else if (button == mButtonHelp)
            {
                currentScreen = new HelpScreen(this);
                cSCREEN       = SCREENS.HELP_SCREEN;
                SoundManager.PlaySound(cSOUND_HIGHLIGHT);
                // Game1.getInstance().getScreenManager().changeScreen(ScreenManager.SCREEN_ID_MAIN_MENU_HELP, false);
            }
            else if (button == mButtonCredits)
            {
                currentScreen = new CreditsScreen(this);
                cSCREEN       = SCREENS.CREDITS_SCREEN;
                SoundManager.PlaySound(cSOUND_HIGHLIGHT);
                //Game1.getInstance().getScreenManager().changeScreen(ScreenManager.SCREEN_ID_MAIN_MENU_CREDITS, false);
            }
            else if (button == mButtonFullscreen)
            {
                SoundManager.PlaySound(cSOUND_HIGHLIGHT);
                Game1.getInstance().toggleFullscreen();
            }
            else if (button == mButtonExit)
            {
                executeFade(mFade, Fade.sFADE_OUT_EFFECT_GRADATIVE);
                mFadeParam = FADE_PARAM.EXIT_GAME;
            }
        }
Example #6
0
 private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     Debug.WriteLine("teste completo");
     mCurrentScreen = mScreenToLoad;
     loading        = false;
 }
Example #7
0
        private BaseScreen returnScreen(int id)
        {
            BaseScreen baseScreen = null;

            switch (id)
            {
            case SCREEN_ID_LOGOS_SCREEN:
                baseScreen = new LogosScreen();
                break;

            case SCREEN_ID_MEMORYGAME:
                baseScreen = new MemoryGameScreen();
                break;

            case SCREEN_ID_MAIN_MENU:
                baseScreen = new MainMenuScreen();
                break;

            case SCREEN_ID_GAMEPLAY:
                baseScreen = new GamePlayScreen();
                break;

            case SCREEN_ID_MAIN_MENU_HELP:
                //baseScreen = new HelpScreen();
                break;

            case SCREEN_ID_MAIN_MENU_CREDITS:
                baseScreen = new CreditsScreen(null);
                break;

            case SCREEN_ID_HISTORY:
                baseScreen = new StoryScreen();
                break;

            case SCREEN_ID_MACROMAP:
                baseScreen = new MacroMapScreen();
                break;

            case SCREEN_ID_CHAR_SELECTION:
                baseScreen = new SelectionScreen();
                break;

            case SCREEN_ID_GAMEOVER:
                baseScreen = new GameoverScreen();
                break;

            case SCREEN_ID_SPLASHSCREEN:
                baseScreen = new SplashScreen();
                break;

            //test purposes
            case SCREEN_ID_LOADING:
                baseScreen = new LoadingScreen();
                break;

            case SCREEN_ID_ENDING_SCREEN:
                baseScreen = new EndingScreen();
                break;
            }
            return(baseScreen);
        }