Created
April 7, 2017 19:58
-
-
Save PoetaKodu/4d886984431ede41c152dd6667060e11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "..\Include\Enemy.hpp" | |
#include "..\Include\Game.hpp" // Klasa gry potrzebna do wyswietlenia wroga. | |
#include "..\Include\TextureManager.hpp" // Klasa menedzera tekstur do ich pobrania. | |
//////////////////////////////////////////////////////// | |
CEnemy::CEnemy() | |
: IPawn(new CEnemyAIController) // Tak jak w klasie gracza wywolujemy konstruktor klasy bazowej z wlasnym kontrolerem AI. | |
{ | |
/* Aby zobaczyc pelne wytlumaczenie ponizszego kodu przejdz do kontruktora klasy CPlayer | |
w pliku Player.cpp | |
*/ | |
auto texture = CTextureManager::Get("Enemy_Stand_01"); // Tym razem ustawimy sobie inna teksturke. | |
m_sprite.setTexture(*texture); // Ustawiamy teksturke | |
m_sprite.setOrigin(36, 36); // Ustawiamy srodek wyswietlania. | |
} | |
//////////////////////////////////////////////////////// | |
void CEnemy::SetLocation(const grim::Vector2 & location) | |
{ | |
// To samo co w CPlayer::SetLocation | |
IPawn::SetLocation(location); | |
m_sprite.setPosition(location.x, location.y); | |
} | |
//////////////////////////////////////////////////////// | |
void CEnemy::Draw() | |
{ | |
// To samo co w CPlayer::Draw | |
CGame::Instance().GetWindow().draw(m_sprite); | |
} | |
//////////////////////////////////////////////////////// | |
CEnemyAIController::CEnemyAIController() | |
{ | |
// Poki co kontroler zostawiamy pusty. | |
} | |
//////////////////////////////////////////////////////// | |
void CEnemyAIController::Update(const float & deltaTime) | |
{ | |
// Poki co kontroler zostawiamy pusty. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment