Chat with us, powered by LiveChat GSP 125 Week 4 iLab Simple Game inheritance NEW // | Writedemy

GSP 125 Week 4 iLab Simple Game inheritance NEW //

GSP 125 Week 4 iLab Simple Game inheritance NEW //

// INSTRUCTIONS
———–Compile this code. You should see a rectangular play field of periods, with
3 Entity objects visible on it. The happy-face Entity moves with the "wasd"
keys, and the club Entity moves with the "ijkl" keys. If the happy-face
reaches the diamond Entity, the player wins. If the happy-face reaches the
club, the player loses.
Read through this code! Try to understand it before starting the assignment.
Comment confusing lines with what you think code is doing, and experiment
with existing code to test your understanding.
Once you feel comfortable with this code, accomplish each of the following,
and make sure your code compiles and runs after each step is completed.
1) Getting comfortable with the game code
a) Implement initialization lists in Vector2, Entity, and Game (setting
object values after a ‘:’, between the constructor signature and body).
Have initialization lists set initial values for each member variable.
b) Add another Entity to the game that isn’t the same location as an
existing Entity. Use a heart icon (ASCII code 3). It should display in
the game.
c) Add logic that makes the club (PLAYER2) win the game if that player
reaches the heart Entity. You may want to make new constants, like
GOAL2, and WIN2, to follow the existing code convention.
d) Make a new private function called "void Game::handleUserInput()", move
the user input handling logic from Game::update() into this new
function, and call Game::handleUserInput from Game::update.
e) Add whitespace to the handleUserInput logic, and comment each line with
what you understand it is doing. If you don’t understand what the code
is doing, experiment with it until you do! Do things like printing
variables you are unsure about, and guess what output will look like.
f) Implement the prototyped overloaded operators for Vector2. Once they
are finished you should be able to use the alternate code for setting
up PLAYER2 in Game::Game() in "game.cpp".
2) A "BlinkEntity" class
a) Create 2 new files in your project: "blinkentity.h", and
"blinkentity.cpp"
b) Make a BlinkEntity class that extends Entity. Declare the class in
"blinkentity.h" and define it’s methods in "blinkentity.cpp". Your
"blinkentity.h" file should look something like:
#pragma once
#include "entity.h"
class BlinkEntity : public Entity {
};
c) Instead of using an Entity for the Entity marked GOAL1 in the Game
constructor, use a BlinkEntity. You will need to create a public
BlinkEntity constructor.
d) Give BlinkEntity another member variable called "alternateIcon". When
BlinkEntity calls it’s update function, swap the values of "icon" and
"alternateIcon". You won’t notice a change during runtime until you add
the virtual modifier to Entity::update().
3) A "WanderingEntity" class
a) Create 2 new files in your project: "wanderingentity.h", and
"wanderingentity.cpp"
b) Make a WanderingEntity class that extends Entity. Declare the class in
"wanderingentity.h" and define it’s methods in "wanderingentity.cpp". //
Your "wanderingentity.h" file should look something like:
//
#pragma once
//
//
#include "entity.h"
//
//
class WanderingEntity : public Entity {
//
};
// c) Instead of using an Entity for the Entity marked PLAYER2 in the Game
//
constructor, use a WanderingEntity. You will need to create a public
//
WanderingEntity constructor.
// d) Create a new update method for WanderingEntity. Declare it in
//
"wanderingentity.h", and define it in "wanderingentity.cpp". In the
//
WanderingEntity::update() method, set the "howToMoveNext" variable
//
to a random number from 0 to 3. You can use "rand() % 4" to do this in
//
"wanderingentity.cpp" if you #include <cstdlib> or <stdlib.h>. After
//
setting the "howToMoveNext" variable in update, call the parent class’s
//
updated with "Entity::update()".
// e) Add at least 2 more WanderingEntity objects in the Game. Add game logic
//
will cause the player to lose if the player shares a location with any
//
WanderingEntity object.

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order