Beispiel #1
0
 public Klavesnica(Keys Space, Keys Up, Keys Down, Keys Left, Keys Right, Tank Player)
 {
     this.Space = Space;
     this.Up= Up;
     this.Down= Down;
     this.Right= Right;
     this.Left = Left;
     this.Player = Player;
 }
Beispiel #2
0
        public void Fire(Tank Player)
        {
            strela = new Strela();

            Strely.Add(strela);
            if ((Player == player1) || (Player == player2))
            {
                strela.Initialize(Player, Player.ShotSpeed, Player.Smer);
            }
            else
            {
                strela.Initialize(Player, (int)(Constants.BulletsSpeed[Player.Type]), Player.Smer);
            }
            strela.LoadGraphicsContent(spriteBatch, Res.Textures["Bullet"]);

            Player.BulletsShot += 1;
        }
Beispiel #3
0
        //skontroluje koliziu s tankom Tank, vracia true ak kolizia nastala
        internal bool CheckCollisionsTank(Tank temp)
        {
            if (this.BoundingRectangle.Intersects(temp.BoundingRectangle)&&(temp.Alive))
            {
                this.Alive = false;
                if (!temp.Indestructable)
                {
                    if (temp.Resistance > 0)
                    {
                         temp.Resistance -= 1;
                         return false;
                    }
                    else
                    {
                        temp.Alive = false;
                        return true;
                    }
                }

                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #4
0
 public void Initialize(Tank Player, int speed, int smer)
 {
     base.Initialize(Player.PositionX ,Player.PositionY, 10, 10 );
     this.speed = speed;
     this.alive = true;
     this.smer = smer;
     this.shotBy = Player;
 }
Beispiel #5
0
 protected override void TankCollision(Tank tank)
 {
     GUIForm.Paint -= OnPaint;
     GUIForm.Paint += OnPaint;
 }
Beispiel #6
0
 protected virtual void TankCollision(Tank tank)
 {
     tank.StopMoving();
 }
Beispiel #7
0
        protected void AddTank(TankType type, Position pos, bool ai = true)
        {
            // žlutý / zelený tank
            Texture2D texture;

            if (type == TankType.Yellow) { texture = this.tankTextures[0]; }
            else { texture = this.tankTextures[1]; }

            //
            Tank tank	=	new Tank(ai);

            // inicializace
            tank.Initialize(this.area, texture, this.prjTextures[0], pos);

            // ochrana aby se tank nevložil na pozici jiného
            if (!this.CheckTankPosition(pos, 2, 2)) { this.Tanks.Add(tank); }
        }