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

UOP GSP 125 Week 1 iLab Simple game NEW

Check this A + tutorial guideline at

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

For more classes visit

http://www.assignmentclick.com/

 

//
//
// INSTRUCTIONS
----------- Compile this code. You should see a happy-face character on a field of
periods. You can move the character with 'w', 'a', 's', and 'd' keys.
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) Object Oriented Refactoring
a) Write a class called Entity to store two public integers named x and y,
and a char named icon (the player data).
b) Remove x, y, and icon (the player data) from main (), create an instance
of the Entity class (named whatever you like) in main (), and use its
members as replacements for the x, y, and icon variables that were
removed.
c) Write a parameterized constructor for the entity class that sets x, y,
and icon, and use it when creating the instance.
d) make x, y, and icon private variables of entity, and create accessor
and mutator functions to use them in main ().
(hint: "player.x ++" could be "player.setX (player.getX () + 1);")
e) Write a struct called Vector2, which has two int variables, x and y.
f) Write a default constructor for Vector2, which sets x and y to 0.
g) Write a parameterized constructor for Vector2, which sets x and y.
h) Remove x, and y from Entity, add to instance of the Vector2 structure
named & quot; pos & quot; to the Entity class, and use pos's members as replacements
for the x, and y variables that were removed.
i) Remove height and width (in the game data) from main (), create at
instance of the Vector2 structure named "size", and use size 's member
as a replacement for width, and size as a replacement for
height ,
j) Write a method in Vector2 with the signature "
bool is (int a_x, int a_y)". & quot; is & quot; should return true if a_x is equal to
that instance's x, and a_y is equal that instance's y.
k) Instantiate a new object of class Vector2 called & quot; winPosition & quot ;, and set
it's x, y value to size.x / 2, size.y / 2.
2) Add Game Logic
a) Add code to the while-loop so that when the player reaches "
winPosition", which should be determined by using the "is & quot; method, the
& quot; state & quot; variable should be set to WIN, ending the game.
b) add code to the while-loop so that the state variable is set to LOST
if the player leaves the playfield (ending the game).
3) Using enums
a) Create an enum called & quot; GameState & quot; with the possible values ​​"RUNNING"
, "WIN", "LOST", and "USER_QUIT".
b) Replace the state variable with an isntance of the GameState enum. // lab1: simplegame_OOP
// & lt; insert your name here & gt;
// read main.cpp, and follow the instructions at the bottom of main.cpp
#include & lt; iostream & gt; // std :: cout using namespace std;
#include & lt; windows.h & gt;
#include & lt; conio.h & gt; // SetConsoleCursorPosition (HANDLE, COORD)
// _getch () struct Vector2 {
int x;
int y;
Vector2 ():
x (0), y (0) {
}
vector2 (int x, int y) {
x = x;
y = y;
}
bool is (int a_x, int a_y) {

 

Diskussion