Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am making a command-line based game called Zombie Madness and the first step is to create the enemies: the zombies. A zombie walks around

I am making a command-line based game called Zombie Madness and the first step is to create the enemies: the zombies. A zombie walks around a field (it has an X and Y position) and can go slow or fast. It can also be freshly dead (it can still eat people), or very dead (it can no longer eat anyone but can move). Zombies also attempt to attack the player and if they reach the player, they attack. Create the class Zombie. Create the protected attributes for this class from the information above (4 attributes) plus 2 more attributes: the destination x position and the destination y position. This is where the zombie is trying to go (slowly)

Create 4 functions:

o setDestination takes two integer parameters (xPos and yPos) and makes that the zombie's desired location.

o Move the zombie towards its target or goal position: the method should be called takeTurn and it has no parameters. The function returns an integer indicating the amount of damage the zombie does to the player (thus most times you expect a 0).

o Print the zombie's position and some information about the zombie. This function should be called printInfo. printInfo doesn't return anything or take any parameters but uses cout statements to output information to the screen.

o The function hit will not take any parameters but instead returns the amount of damage the zombie does (let's say it returns the value 3 for "3 hit points" from the player. If the zombie is very dead, the value returned is 0). Notice this value is then returned from takeTurn.

o You should probably also make getter methods for various attributes as well. You can choose what attributes other classes need to have access to.

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_2

Step: 3

blur-text-image_3

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Find the partial sum. 1. 2. 3. 50 n=1 100 n=51

Answered: 1 week ago