Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will (partially) build a game about peaches. The game has players moving about in a world trying to find, eat and store peaches. You

You will (partially) build a game about peaches. The game has players moving about in a world trying to find, eat and store peaches. You will implement two classes (a Location subclass and a Player subclass).

Location subclass:

A Home is the home location. There is only one home in each world. This is where several of the players will begin the game. Is is a place for players to drop off (to stockpile) peaches. The home keeps track of how many peaches each player brings back. The home will also create a new Helper player to go help another player in distress (low health). It will give the helper the location of the player in distress and some peaches to give to the distressed player to eat.

Player subclass:

A Helper is created and dispatched from the home location whenever a player (pit finder or peach hunter) asks for help. They bring a bunch of peaches to the player (giving them to the player when they interact with them). Once a helper helps someone they go back home (and do nothing for the rest of the game). A helper will not give any peaches to a bear.

The provided PeachesGame program is a simple starting point for the game. Essentially, it lets each player in the world have their turn (play method) and repeats until the home location has accumulated enuogh peaches.

Here are the provided classes and my start to the home subclass: https://pastebin.com/xjJK5ZeS

Not quite sure how to make sure all the players start at this location at the beginning of the game. Also, would the callForHelp method in location be further expanded in the home subclass to instantate the helper player?

Thank you.

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

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions