public Bullet(Constants.DIRECTIONS direction, Player player) { Direction = direction; this.PositionX = player.PositionX + (player.Width / 2); this.PositionY = player.PositionY + (player.Height / 2); this.Width = 25; this.Height = 25; Velocity = 20; RemoveMark = false; Animation = AllAnimations.bullet; }
public void UpAndDown() { if (y > 5) { ydirection = Constants.DIRECTIONS.DOWN; } if (y < -5) { ydirection = Constants.DIRECTIONS.UP; } switch (ydirection) { case Constants.DIRECTIONS.UP: this.transform.Translate(Vector3.up); y += 1; return; case Constants.DIRECTIONS.DOWN: this.transform.Translate(Vector3.down); y += -1; return; } }
public void BackAndForth() { if (x > 5) { xdirection = Constants.DIRECTIONS.LEFT; } if (x < -5) { xdirection = Constants.DIRECTIONS.RIGHT; } switch (xdirection) { case Constants.DIRECTIONS.RIGHT: this.transform.Translate(Vector3.right); x += 1; return; case Constants.DIRECTIONS.LEFT: this.transform.Translate(Vector3.left); x += -1; return; } }