MGT 317,HRM 326,GSP 125,CMGT 582,FIN 585,ACCT 505,CIS 517,CIS 517,BUS 661,ECET 365 , ,

UOP GSP 125 Week 4 iLab Simple Game inheritance NEW

 

Check this A + tutorial guideline at

http://www.assignmentclick.com/gsp-125-devry/gsp-125-week-4-ilab-simple-game-inheritance-latest

For more classes visit

http://www.assignmentclick.com/

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 & quot; wasd & quot;
keys, and the club entity moves with the & quot; ijkl & quot; 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 on how to
do it, how to do it, how to do it.
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 initial values ​​for each member variable.
b) Add another entity to the game that is not the same location as an
existing entity. Use a heart icon (ASCII code 3). It should be display in
the game.
c) Add logic that makes the club (PLAYER2) win the game
. 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 do not understand what the code
is doing, experiment with it until you do! Do things like printing
variable you are unsure about, and guess what output will look like 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 & quot; game.cpp & quot ;.
2) A & quot; BlinkEntity & quot; class
a) Create 2 new files in your project: & quot; blinkentity.h & quot ;, and
& quot; blinkentity.cpp & quot;
b) Make a BlinkEntity class that extends Entity. Declare the class in
& quot; blinkentity.h & quot; and define it's methods in & quot; blinkentity.cpp & quot ;. Your
& quot; blinkentity.h & quot; 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 want to create a public
BlinkEntity constructor.
d) Give BlinkEntity another member variable called & quot; alternateIcon & quot ;. When
BlinkEntity calls it's update function, swap the values ​​of & quot; icon & quot; and
& quot; alternateIcon & quot ;. You will not notice a change during runtime until you add
the virtual modifier to Entity :: update ().
3) A & quot; Wandering Entity & quot; class
a) Create 2 new files in your project: & quot; wanderingentity.h & quot ;, and
& quot; wanderingentity.cpp & quot;
b) Make a Wandering Entity class that extends Entity. Declare the class in
& quot; wanderingentity.h & quot; and define it's methods in & quot; wanderingentity.cpp & quot ;. //
your & quot; wanderingentity.h & quot; 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 want 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 & quot; howToMoveNext & quot; variable
//
to a random number from 0 to 3. You can use & quot; rand ()% 4 & quot; to do this in
//
& quot; wanderingentity.cpp & quot; if you #include & lt; cstdlib & gt; or & lt; stdlib. h & gt ;. nach
//
setting the & quot; howToMo

 

Diskussion