Beispiel #1
0
        public void updatePlayer(int x, int y, int dir, bool shot, int health, int coins, int points, Data_Items.Square newSqr)
        {
            this.position = new Vector2(x, y);
            this.direction = dir;
            this.points = points;
            this.coins = coins;
            this.health = health;
            this.shot = shot;

            if(health <= 0)
            {
                isAlive = false;
                currentSquare.removePlayer();
            }

            else if(this.currentSquare != newSqr)
            {
                if (this.currentSquare.getPlayer() == this)
                {
                    this.currentSquare.removePlayer();
                }

                this.currentSquare = newSqr;
                this.currentSquare.addPlayer(this);
            }
        }
Beispiel #2
0
 public Player(int n, int x, int y, int dir, Color clr, Data_Items.Square current)
 {
     this.playerNumber = n;
     this.position = new Vector2(x, y);
     this.direction = dir;
     this.color = clr;
     this.points = 0;
     this.coins = 0;
     this.isAlive = true;
     this.health = 100;
     this.shot = false;
     this.currentSquare = current;
 }