Example #1
0
        protected void battle_sprite_setup(int timer)
        {
            // sure looks like 11 should be a constant here //@Yeti

            //@Debug: should use lerp for battler scale?

            timer = Math.Max(timer, 0);
            Platform_Effect_Ratio = timer / 11f;
            Battler_1_Sprite.loc  = (Battler_1_Map_Loc + Pan_Vector) * ((11 - (timer)) / 11.0f) +
                                    Battler_1_Loc * ((timer) / 11.0f);
            //Battler_1_Sprite.loc = Battler_1_Map_Loc * ((11 - (timer)) / 11.0f) +
            //    Battler_1_Loc * ((timer) / 11.0f);
            Battler_1_Sprite.scale = new Vector2(Global.BattleSceneConfig.BattlerMinScale) * ((11 - (timer)) / 11.0f) +
                                     Vector2.One * ((timer) / 11.0f);
            Battler_1_Sprite.update_animation_position();
            if (Battler_2_Sprite != null)
            {
                Battler_2_Sprite.loc = (Battler_2_Map_Loc + Pan_Vector) * ((11 - (timer)) / 11.0f) +
                                       Battler_2_Loc * ((timer) / 11.0f);
                //Battler_2_Sprite.loc = Battler_2_Map_Loc * ((11 - (timer)) / 11.0f) +
                //    Battler_2_Loc * ((timer) / 11.0f);
                Battler_2_Sprite.scale = new Vector2(Global.BattleSceneConfig.BattlerMinScale) * ((11 - (timer)) / 11.0f) +
                                         Vector2.One * ((timer) / 11.0f);
                Battler_2_Sprite.update_animation_position();
            }
            Platform_Loc_2 = Battler_2 == null ? (Battler_1_Map_Loc + Pan_Vector) * ((11 - (timer)) / 11.0f) +
                             Battler_2_Loc * ((timer) / 11.0f) : Battler_2_Sprite.loc;
        }
        private void promotion_fade_in_initialize()
        {
            initialize_battle_sprites();
            Battler_1_Sprite.loc   = new Vector2(Battler_1_Loc.X, 176);
            Battler_1_Sprite.scale = Vector2.One;
            Battler_1_Sprite.reset_pose();
            Battler_1_Sprite.update_animation_position();
            Battler_1_Sprite.visible = true;

            HUD = null;
            if (!WaitingOnPromotionChoice)
            {
                // HUD
                setup_hud();
                HUD.complete_move();
            }
            // Create platforms
            create_platforms();
            Platform.add_y(-110);
            // White screen flash
            White_Screen           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
            White_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
            White_Screen.visible   = false;

            // Start offscreen on the right if the promotion choice menu
            if (WaitingOnPromotionChoice)
            {
                Pan_Vector = new Vector2(this.OffscreenOffset, 0);
            }

            Black_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
            Black_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
            Black_Fill.tint      = new Color(0, 0, 0, 0);
            // Create background
            if (is_battle_bg_visible)
            {
                Background = new Sprite(background(this.background_battler));
                Background.stereoscopic = Config.BATTLE_BG_DEPTH;
                Black_Backing           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                Black_Backing.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                Black_Backing.tint      = new Color(0, 0, 0, 255);
            }

            Skip_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
            Skip_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
        }
Example #3
0
        protected virtual void update_phase_0()
        {
            bool cont = false;

            while (!cont)
            {
                cont = true;
                switch (Timer)
                {
                case 0:
                    initialize_battle_sprites();
                    Timer++;
                    break;

                case 1:
                    Platform_Effect_1        = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    Platform_Effect_1.offset = new Vector2(8, 8);
                    if (Battler_2 != null && Distance > 1)
                    {
                        Platform_Effect_2        = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                        Platform_Effect_2.offset = new Vector2(8, 8);
                    }
                    battle_sprite_setup(0);
                    Timer++;
                    break;

                case 2:
                case 3:
                    Battler_1_Sprite.visible = false;
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.visible = false;
                    }
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    break;

                case 4:
                    Battler_1_Sprite.visible  = true;
                    Battler_1_Sprite.offset.Y = 120;
                    Battler_1_Sprite.update_animation_position();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.visible  = true;
                        Battler_2_Sprite.offset.Y = 120;
                        Battler_2_Sprite.update_animation_position();
                    }
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    break;

                case 5:
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    break;

                case 6:
                    battle_sprite_setup(Timer - 3);
                    // HUD
                    setup_hud();
                    // Create platforms
                    create_platforms();
                    // White screen flash
                    White_Screen           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    White_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    White_Screen.visible   = false;
                    Timer++;
                    break;

                case 7:
                case 8:
                    battle_sprite_setup(Timer - 3);
                    // 110 total platform movement
                    Platform.add_y(-(Timer + 3));
                    Timer++;
                    break;

                case 9:
                case 10:
                case 11:
                    battle_sprite_setup(Timer - 3);
                    Platform.add_y(-(Timer + 6));
                    Timer++;
                    break;

                case 12:
                case 13:
                    battle_sprite_setup(Timer - 3);
                    Platform.add_y(-(Timer + 8));
                    Timer++;
                    break;

                case 14:
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    Platform_Effect_1 = null;
                    Platform_Effect_2 = null;
                    break;

                case 15:
                    Battler_1_Sprite.loc   = new Vector2(Battler_1_Loc.X, 176);
                    Battler_1_Sprite.scale = Vector2.One;
                    Battler_1_Sprite.reset_pose();
                    Battler_1_Sprite.update_animation_position();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.loc   = new Vector2(Battler_2_Loc.X, 176);
                        Battler_2_Sprite.scale = Vector2.One;
                        Battler_2_Sprite.reset_pose();
                        Battler_2_Sprite.update_animation_position();
                    }
                    Battler_1_Sprite.initialize_animation();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.initialize_animation();
                    }

                    Platform_Effect_1 = null;
                    Platform_Effect_2 = null;
                    Timer++;
                    break;

                case 16:
                    Black_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    Black_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    if (is_battle_bg_visible)
                    {
                        Black_Fill.tint = new Color(0, 0, 0, 32);
                    }
                    else
                    {
                        Black_Fill.tint = new Color(0, 0, 0, 0);
                    }
                    Timer++;
                    break;

                case 17:
                case 18:
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                    if (is_battle_bg_visible)
                    {
                        Black_Fill.tint = new Color(0, 0, 0, (int)MathHelper.Min((Timer - 15) * 32, 255));
                        if (Timer > 19)
                        {
                            Weather_Opacity = (Timer - 19) / 16f;
                        }
                    }
                    Timer++;
                    break;

                case 24:
                case 25:
                    if (is_battle_bg_visible)
                    {
                        Weather_Opacity = (Timer - 19) / 16f;
                    }
                    Timer++;
                    break;

                case 26:
                    // Create background
                    if (is_battle_bg_visible)
                    {
                        Background = new Sprite(background(this.background_battler));
                        Background.stereoscopic = Config.BATTLE_BG_DEPTH;
                        Black_Backing           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                        Black_Backing.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                        Black_Backing.tint      = new Color(0, 0, 0, 255);

                        Weather_Opacity = (Timer - 19) / 16f;
                    }
                    else
                    {
                        cont = false;
                    }
                    Timer++;
                    break;

                case 27:
                case 28:
                case 29:
                case 30:
                case 31:
                case 32:
                case 33:
                case 34:
                case 35:
                    if (is_battle_bg_visible)
                    {
                        Black_Fill.tint = new Color(0, 0, 0, (int)MathHelper.Min((35 - Timer) * 32, 255));
                        Weather_Opacity = (Timer - 19) / 16f;
                        //Weather_Opacity = (Timer - 27) / 8f;
                    }
                    else
                    {
                        cont = false;
                    }
                    Timer++;
                    break;

                case 36:
                    battle_start_text();
                    if (!Music_Started && (!test_battle_theme() || !Global.game_temp.boss_theme))
                    {
                        Global.Audio.BgmFadeOut(60);
                    }
                    Global.game_temp.boss_theme = false;
                    Timer++;
                    break;

                case 72:
                    if (!Music_Started)
                    {
                        play_battle_theme();
                        Music_Started = true;
                    }
                    Battler_1_Sprite.start_battle();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.start_battle();
                    }
                    Timer++;
                    break;

                case 73:
                    if (Battler_1_Sprite.duration <= 2 && (Battler_2_Sprite == null || Battler_2_Sprite.duration <= 2))
                    {
                        check_talk(Battler_1, Battler_2, Reverse);
                        Timer++;
                    }
                    break;

                case 74:
                    if (!is_message_window_active && HUD.is_ready && !Message_Active)
                    {
                        Timer = 0;
                        Phase = 1;
                    }
                    break;

                default:
                    Timer++;
                    break;
                }
            }
        }