Summary

This chapter helps you begin thinking like an experienced programmer. The way you work with complex data has a profound effect on how successfully you solve interesting programming problems. In this chapter you learned how to build arrays to store lists of information. You learned how to use the properties and methods of the array class to inspect and modify an array. You learned how to build arrays of simple elements such as integers and strings and more complex elements such as picture boxes. You learned how to build a form without using the Visual Designer and how to add event handlers to components you have built by hand. Finally, you put all these skills together to build an interesting game. In the next chapter you will move on to another important part of data manipulation: moving data to and from files.

NOTE

CHALLENGES

  • Add multiple difficulty levels to the game. Let the user choose a difficulty, and adjust the opponent’s likelihood of scoring based on the difficulty factor.

  • Change the likelihood of a pass so that it is related to the distance between the shooter and the target. You might recall the distance formula from math class: distance = square root of ( (x2 - x1)2 + (y2 - y1)2)

  • Write a method that accepts two picture boxes, calculates the distance between them, and makes the likelihood of success dependent on that distance.

  • Make a Windows version of the Snowball Fight program from Chapter 5, Constructors, Inheritance, and Polymorphism: The Snowball Fight.” Use picture boxes to indicate the players' behavior and buttons to get commands from the user.

  • Modify the behavior and performance of the Soccer game to mirror a similar sport (hockey, basketball, and volleyball make interesting candidates). Change the images and behavior to mimic the sport. For example, basketball is a much higher scoring game than soccer, so the likelihood of scoring has to be much greater.

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

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