예제 #1
0
        /// <summary>
        /// Uaktualnia obiekty na mapie.
        /// </summary>
        /// <param name="gameTimer"></param>
        /// <param name="player">Obikt gracza</param>
        public void Update(GameTime gameTimer, ref Tony player)
        {
            //float x = Tony.position.X;

            Vector2 ob = new Vector2(player.position.X / 48, player.position.Y / 48);

            // map[(int)ob.X, (int)ob.Y].isEmpty = StateField.empty;
            if (map[(int)ob.X, (int)ob.Y].isEmpty == StateField.rubin)
            {
                numRubin--;
                Level.points += 30;
                if (numRubin == 0 && isdiamond == false)
                {
                    setDiamond();
                }
            }
            else if (map[(int)ob.X, (int)ob.Y].isEmpty == StateField.diamond)
            {
                Level.points += 100;
                clear         = true;
            }
            if (map[(int)ob.X, (int)ob.Y].isEmpty != StateField.trap)
            {
                map[(int)ob.X, (int)ob.Y].isEmpty = StateField.empty;
            }
        }
예제 #2
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;
        }
예제 #3
0
 /// <summary>
 /// Tworzy nowy obiekt typu Robak
 /// </summary>
 /// <param name="newTexture">textura dla Robaka</param>
 /// <param name="newPosition">now pozycja</param>
 /// <param name="newTony">obiekt gracza</param>
 public Robak(Texture2D newTexture, Vector2 newPosition,Tony newTony)
     : base(newTexture, newPosition)
 {
     oTony = newTony;
 }
예제 #4
0
 /// <summary>
 /// Tworzy nowy obiekt typu Robak
 /// </summary>
 /// <param name="newTexture">textura dla Robaka</param>
 /// <param name="newPosition">now pozycja</param>
 /// <param name="newTony">obiekt gracza</param>
 public Robak(Texture2D newTexture, Vector2 newPosition, Tony newTony)
     : base(newTexture, newPosition)
 {
     oTony = newTony;
 }
예제 #5
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;
        }
예제 #6
0
파일: Map.cs 프로젝트: naporalukasz/Digger
        /// <summary>
        /// Uaktualnia obiekty na mapie.
        /// </summary>
        /// <param name="gameTimer"></param>
        /// <param name="player">Obikt gracza</param>
        public void Update(GameTime gameTimer, ref Tony player)
        {
            //float x = Tony.position.X;

            Vector2 ob = new Vector2(player.position.X / 48, player.position.Y / 48);
               // map[(int)ob.X, (int)ob.Y].isEmpty = StateField.empty;
            if (map[(int)ob.X, (int)ob.Y].isEmpty == StateField.rubin)
            {
                numRubin--;
                Level.points += 30;
                if (numRubin == 0 && isdiamond == false)
                    setDiamond();
            }
            else if (map[(int)ob.X, (int)ob.Y].isEmpty == StateField.diamond)
            {
                Level.points += 100;
                clear = true;
            }
            if( map[(int)ob.X, (int)ob.Y].isEmpty != StateField.trap)
                map[(int)ob.X, (int)ob.Y].isEmpty = StateField.empty;
        }