Esempio n. 1
0
 public CreatureCommand Act(Map map, int x, int y)
 {
     return new CreatureCommand
     {
         DeltaX = 0,
         DeltaY = 0,
     };
 }
Esempio n. 2
0
        public DiggerWindow(Map map)
        {
            this.map = map;
            ClientSize = new Size(ElementSize * map.Width + MessagesWidth, Math.Max(ElementSize * map.Height,300));
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            Text = "Digger";
            DoubleBuffered = true;

            var imagesDirectory = new DirectoryInfo("..\\..\\Images");
            foreach(var e in imagesDirectory.GetFiles())
                if (e.Extension==".png")
                 bitmaps[e.Name.ToLower()]=(Bitmap)Bitmap.FromFile(e.FullName);
            var timer = new Timer();
            timer.Interval = 1;
            timer.Tick += TimerTick;
            timer.Start();
        }
Esempio n. 3
0
        /// <summary>
        /// Tworzy nowy obiekt typu Level
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="currpoint">Punkty od ktorych ma sie zaczac level</param>
        public Level( GraphicsDevice graphics, int currpoint)
        {
            bonus = new List<Bonus>();
            enemy = new List<Robak>();
            enemySuper = new List<SuperRobak>();
            trap = new List<Trap>();
            points = currpoint;

               // size = new Vector2(graphics.Viewport.Width, graphics.Viewport.Height );
            map = new Map();
            player = new Tony(Source.tony, Map.startPosition);
            countEnemy();
            enemy.Add(new Robak(Source.robak, Map.endPosition, player));
            enemyTimer.Tick += new EventHandler(AddEnemy);
            enemyTimer.Interval = 8000;
            enemyTimer.Start();
            levelEnd = false;
            Tony.dead = false;
        }
Esempio n. 4
0
        public CreatureCommand Act(Map map, int x, int y)
        {
            SuccessfulMovement = true;
            int nx=x;
            int ny=y;
            switch(RequestedMovement)
            {
                case Directions.Up: ny--; break;
                case Directions.Down: ny++; break;
                case Directions.Left: nx--; break;
                case Directions.Right: nx++; break;
            }
            if (nx < 0 || nx >= map.Width) nx = x;
            if (ny < 0 || ny >= map.Height) ny = y;

            if (map[nx,ny] is Brick)
            {
                map.Messages.Add("Вы расшиблись о стену");
                map.GameOver = true;
                SuccessfulMovement = false;
            }
            if (map[nx,ny] is Door)
            {
                map.Messages.Add("Вы прошли уровень");
                File.WriteAllText("level.txt", (map.LevelNumber + 1).ToString());
                map.GameOver = true;
            }
            if (map[nx,ny] is Wood)
            {
                SuccessfulMovement = false;
                nx = x;
                ny = y;
            }

            return new CreatureCommand { DeltaX = nx - x, DeltaY = ny - y, TransformTo = null };
        }