Example #1
0
        public CreatureCommand Act(int x, int y)
        {
            CreatureMovement sack = new CreatureMovement();

            var downobj = Game.Map[x, (y + 1) % Game.MapHeight];

            //bool kill = (downobj is Player || downobj is Monster) && highCount > 0;
            bool kill = (downobj is Player) && highCount > 0;


            sack.Down = new bool[] { downobj is null || kill, y < Game.MapHeight - 1 };

            if (!sack.Down.Contains(false))
            {
                highCount += 1;
            }
            else if (highCount > 1)
            {
                return new CreatureCommand {
                           TransformTo = new Gold()
                }
            }
            ;
            else
            {
                highCount = 0;
            }

            return(sack.Move());
        }
Example #2
0
        public CreatureCommand Act(int x, int y)
        {
            CreatureMovement player = new CreatureMovement();



            player.Right = new bool[] { Game.KeyPressed == Keys.Right,
                                        x < Game.MapWidth - 1 && !(Game.Map[x + 1, y] is Sack) };
            player.Left = new bool[] { Game.KeyPressed == Keys.Left, x > 0 && !(Game.Map[x - 1, y] is Sack) };
            player.Up   = new bool[] { Game.KeyPressed == Keys.Up, y > 0 && !(Game.Map[x, y - 1] is Sack) };
            player.Down = new bool[] { Game.KeyPressed == Keys.Down, y < Game.MapHeight - 1 && !(Game.Map[x, y + 1] is Sack) };

            return(player.Move());
        }