Question: Hello, I need help creating a Christmas theme for the enemy using a decorator pattern. I want to make the enemy an angry snowman or
Hello, I need help creating a Christmas theme for the enemy using a decorator pattern. I want to make the enemy an angry snowman or something like that. Could you please help me with this?
#define ENEMYH
#include "Object.h
##include "AnimatedObject.h
class GUI;
class Player;
class Enemy :public AnimatedObject
public:
Enemy delete;
Enemystd::string animationFile, VectorD columnRow, const std::uniqueptr& gui;
void updateObject::Command command, std::vector& objects override;
Object copyMe override;
private:
;
#endif ENEMYH
VEnemy::Enemystd::string animationFile, VectorD columnRow, const std::uniqueptr& gui
: AnimatedObjectanimationFile position, Object::Type::enemy, gui
Vvoid Enemy::updateObject::Command command, std::vector& objects
v
auto playerIter std::findifobjectsbegin objects.endauto& object
return objectgetName Object::Type::player;
;
if playerIter objects.end
if position playerItergetPosition
state State::stillRight;
else
state State::stillLeft;
updateSprite;
Object Enemy::copyMe
return new Enemythis;
#include "HolidayDecorator.h
void HolidayDecorator::updatePlayer& player, std::vector& monsters
decoratedObjectupdateplayer monsters;
void HolidayDecorator::renderSDLRenderer renderer
decoratedObjectrenderrenderer;
addHolidayEffectrenderer;
Object HolidayDecorator::copyMe const
return new HolidayDecoratorstd::uniqueptr
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
