Question: I need help on what I could do for this game, could you please help? I have added the specifications from the last assignment in
I need help on what I could do for this game, could you please help? I have added the specifications from the last assignment in case you need it
You will need to extend the functionality of the gameANDuse one of the design patterns from the second group assignment.
Task pick a pattern:
Strategy Pattern: You can switch all of the commands the player can obey up left, down, right, jump, attack into this pattern. You can also add powerups to the game.
Decorator Pattern: Powerups could possible use this also.
Observer Pattern:You can use this pattern to have the enemies aim at or chase the player.
Factory Pattern: Add the ability to shoot to the game or randomly appearing enemies.
Task pick some functionality to add:
Add health meter and take damage when you run into an enemy.
Enemies fight back: they chase the player and can damage or kill him
Other enemies. There are other types of enemies normally on this level. Add at least two different ones with differening functionality.
Second level. When the player reaches end of the map, a second section is available to them with different blocksenemies
Be imaginative. Send me your ideas and I'll let you know if they are sufficient.
Task Summary:
Continuing with our development of our game, in this Quest you will be adding side scrolling to the game as well as victory and loss conditions..
Player Class:
Starting with the changes to the player class there is a new bool isDead false ; private member that keeps track of if the player has collided with an enemy or if the player has gone off the bottom of the screen. Either of these conditions would turn the member to true. A getter will also be needed for this member.
The main changes to the class are the update method. You still need to check that the player doesn't go off the left side of the screen. However, moving right is different.
First, I created a nonmember, helper function with the following declaration:
bool lastBlockOnScreenconst std::vector& objects
This loops over the objects vector and finds the object with the largest x value being sure not to check the player It returns true if that value is less than or equal to GUI: :screenDimensions. x otherwise false.
The next addition to the player's update method is side scrolling.
If the player's x position is greater than half the screen's width and the last block is not on the screen, then
you should subtract the difference between the player's x position and screenDimensions.x from EVERY object in the game.
This will have the effect of sliding everything but the player to the left and it will appear that the player is walking to the right.
A minor change to the moveRight and moveLeft methods. The respective jumping states need to also adjust the position by the walkSpeed. So if the player is in the jumpRight state, pressing the right key will make the player move right. For this to be effective, the user would need to tap the jump button, then quickly press and hold the right key. If you did not add jumping to the previous quest, you can use my solution to have jumping available.
AnimatedObject Class:
The only change to the AnimatedObject class is the collision method, it has a new declaration:
bool collisionconst Object object, bool full false;
NOTE:: you can pass by & instead of raw pointers if you like.
The motivation for this change is to allow the player to be on different levels of blocks and not automatically bumped to the top of a block that he collides with. This image will help:
The red box indicates where we want to detect collisions. The simple fix is that the block's height will just be considered the same as the value of gravity.y This way, when gravity is applied, the player will be popped back on top of the block.
I also removed checking to see if the player's top was within the collision area. That way a jump will not bump the player more than a gravity hit.
So checking for block collision should pass in "false" for full, but checking for collision with an enemy, we want to pass in "true". If full is "true" then it uses the previous collision detection.
Engine Class
We are changing all instances of classes to smart pointers. This includes the vector objects. All necessary changes, through the program, will need to be made. Especially for parameter lists that had player, blocks, enemies as separate items. Now it is all one.
The Engine's changeGameState now simply loops over each of these objects and calls their update method. During this loop, it needs to detect the Player object and set the engine's gameOver and gameWon members based upon the player. gameOver is set to true if the player's isDead member is true, or if the player has reached the right edge of the screen. gameWon is set true when the player reaches the right side of the screen.
I have updated the Engine's constructor with the new level map. Since the Engine class has a vector of Object pointers, we need to set up the five from the rule
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
