Exemple #1
0
        public Player(BattleArena arena, ControlSet Controls, int ID, PlayerDef definition)
        {
            this.World  = arena;
            PokemonName = definition.Pokemon.Name;
            anim        = new Animation(Pokemon.Animation);
            anim.state.SetAnimation("idle", true);
            foreach (MixItem item in Pokemon.MixQueue)
            {
                anim.stateData.SetMix(item.From, item.To, item.Time);
            }
            this.Controls       = Controls;
            this.HP             = Pokemon.HP;
            this.Attack         = Pokemon.Attack;
            this.Defense        = Pokemon.Defense;
            this.SpecialAttack  = Pokemon.SpecialAttack;
            this.SpecialDefense = Pokemon.SpecialDefense;
            this.Speed          = Pokemon.Speed;
            this.ID             = (short)ID;

            for (int i = 0; i < 4; i++)
            {
                Move[i] = new MoveInstance(definition.Moves[i]);
            }

            InitPhysics(arena);
        }
Exemple #2
0
        public Player(BattleArena arena, ControlSet Controls, int ID, PlayerDef definition)
        {
            this.World = arena;
            PokemonName = definition.Pokemon.Name;
            anim = new Animation(Pokemon.Animation);
            anim.state.SetAnimation("idle", true);
            foreach (MixItem item in Pokemon.MixQueue) {
                anim.stateData.SetMix(item.From, item.To, item.Time);
            }
            this.Controls = Controls;
            this.HP = Pokemon.HP;
            this.Attack = Pokemon.Attack;
            this.Defense = Pokemon.Defense;
            this.SpecialAttack = Pokemon.SpecialAttack;
            this.SpecialDefense = Pokemon.SpecialDefense;
            this.Speed = Pokemon.Speed;
            this.ID = (short)ID;

            for (int i = 0; i < 4; i++) {
                Move[i] = new MoveInstance(definition.Moves[i]);
            }

            InitPhysics(arena);
        }
        public void Update(float dt)
        {
            bool AllReady = true;
            foreach (PlayerCursor cursor in cursors) {
                if (cursor.State == CursorState.PokemonSelect) {
                    if (cursor.control.IsPressed(Control.Right)) {
                        cursor.Position.MoveRight();
                    }

                    if (cursor.control.IsPressed(Control.Left)) {
                        cursor.Position.MoveLeft();
                    }

                    if (cursor.control.IsPressed(Control.Up)) {
                        cursor.Position.MoveUp();
                    }

                    if (cursor.control.IsPressed(Control.Down)) {
                        cursor.Position.MoveDown();
                    }

                    if (cursor.control.IsPressed(Control.Accept)) {
                        Pokemon pkmn = PokemonSlots[cursor.Position.X, cursor.Position.Y].Pokemon;
                        if (pkmn != null) {
                            cursor.Pokemon = pkmn;
                            cursor.State = CursorState.MoveSelect;
                            MoveLists[cursor.PlayerNumber].Reload(cursor);
                        }
                    }
                } else if (cursor.State == CursorState.MoveSelect) {
                    MoveLists[cursor.PlayerNumber].Update();
                } else if (cursor.State == CursorState.Ready) {
                    if (cursor.control.IsPressed(Control.Cancel)) {
                        cursor.State = CursorState.MoveSelect;
                    }
                }

                AllReady &= (cursor.State == CursorState.Ready);

            }

            if (AllReady) {
                PlayerDef p1 = new PlayerDef();
                p1.Pokemon = cursors[0].Pokemon;
                p1.Moves = cursors[0].Moves;

                PlayerDef p2 = new PlayerDef();
                p2.Pokemon = cursors[1].Pokemon;
                p2.Moves = cursors[1].Moves;

                Program.SwitchState(new Battle(p1, p2));
            }
        }
Exemple #4
0
 public Battle(PlayerDef player1, PlayerDef player2)
 {
     PlayerOne = player1;
     PlayerTwo = player2;
 }
Exemple #5
0
 public Battle(PlayerDef player1, PlayerDef player2)
 {
     PlayerOne = player1;
     PlayerTwo = player2;
 }
Exemple #6
0
        public void Update(float dt)
        {
            bool AllReady = true;

            foreach (PlayerCursor cursor in cursors)
            {
                if (cursor.State == CursorState.PokemonSelect)
                {
                    if (cursor.control.IsPressed(Control.Right))
                    {
                        cursor.Position.MoveRight();
                    }

                    if (cursor.control.IsPressed(Control.Left))
                    {
                        cursor.Position.MoveLeft();
                    }

                    if (cursor.control.IsPressed(Control.Up))
                    {
                        cursor.Position.MoveUp();
                    }

                    if (cursor.control.IsPressed(Control.Down))
                    {
                        cursor.Position.MoveDown();
                    }

                    if (cursor.control.IsPressed(Control.Accept))
                    {
                        Pokemon pkmn = PokemonSlots[cursor.Position.X, cursor.Position.Y].Pokemon;
                        if (pkmn != null)
                        {
                            cursor.Pokemon = pkmn;
                            cursor.State   = CursorState.MoveSelect;
                            MoveLists[cursor.PlayerNumber].Reload(cursor);
                        }
                    }
                }
                else if (cursor.State == CursorState.MoveSelect)
                {
                    MoveLists[cursor.PlayerNumber].Update();
                }
                else if (cursor.State == CursorState.Ready)
                {
                    if (cursor.control.IsPressed(Control.Cancel))
                    {
                        cursor.State = CursorState.MoveSelect;
                    }
                }

                AllReady &= (cursor.State == CursorState.Ready);
            }

            if (AllReady)
            {
                PlayerDef p1 = new PlayerDef();
                p1.Pokemon = cursors[0].Pokemon;
                p1.Moves   = cursors[0].Moves;

                PlayerDef p2 = new PlayerDef();
                p2.Pokemon = cursors[1].Pokemon;
                p2.Moves   = cursors[1].Moves;

                Program.SwitchState(new Battle(p1, p2));
            }
        }