Setting Up the Goalies

Both the goalies are part of the picPlayer array, and both have already been set up, for the most part. However, they deserve special treatment because they are positioned differently than the other players and have different images. Note that the user’s goalie is named GOALIE, and the opposing goalie is named SHOT.

private void setupGoalies(){
  //place goalies more carefully
  int x;
  int y;

  x = (int)((pnlField.Width - picPlayer[GOALIE].Width)/2);
  y = pnlField.Height - picPlayer[GOALIE].Height- 20;
  picPlayer[GOALIE].Location = new Point(x, y);
  picPlayer[SHOT].Location = new Point(x, 0);
  picPlayer[GOALIE].Image = myPics.Images[5];
  picPlayer[SHOT].Image = myPics.Images[4];
} // end setupGoalies

I used the now familiar horizontal centering routine to get the horizontal placement of the goalies. I moved the user goalie right above the bottom of the field and placed the opposing goalie near the top of the field. I then assigned appropriate images to the goalies from the image list.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.220.92