Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

More players How about giving your game another opponent, call it, say, *_phockeyrobot2. See how this works. You should initialize them to start at different

More players

How about giving your game another opponent, call it, say, *_phockeyrobot2. See how this works. You should initialize them to start at different positions, and to go to different positions in any reset calls, otherwise they may stay on top of each other.

Really it would be better to have the teammates' behaviors be quite different. One could guard the goal, say, while the other pressed forward. One way to do this would be to have the phockeyrobot2 be an instance of a different class called, say, cCritterHockeyRobot2, perhaps a child class of cCritterHockeyRobot and to give it a different update method. Another approach might be to make the robots' behavior depend on a nicely packaged set of parameters; rather than having several separate parameters, we could encapsulate them in a cRobotParam helper class.

In any case, as you add players, you will probably want to make the _border larger so the hockey robots have more room. Can you have more than two of them? How about adding some hockey robots to your own team?

Let's do a series of exercises to turn the Airhockey game into a Basketball game. You can either change the Airhockey game, or if you want to keep that one around, you can copy the gameairhockey.* files to gamebasketball.* files, adding the new files to the project, and then going through and changing the various capitalization forms of 'airhockey' to 'basketball' in the two files as was discussed in Exercise 3.7: Renaming a game.

For the purposes of the following exercises, we'll assume you took the easier route and are working directly on the Airhockey game.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Design Operation And Evaluation Of Mobile Communications

Authors: Gavriel Salvendy ,June Wei

1st Edition

3030770249, 978-3030770242

Students also viewed these Programming questions

Question

What made you decide on this subfield of psychology?

Answered: 1 week ago

Question

Convert the numeral to a HinduArabic numeral. A94 12

Answered: 1 week ago