Untitled
unknown
plain_text
a year ago
1.8 kB
11
Indexable
#include <string>
#include "SoldierEnemy.hpp"
#include "Engine/Sprite.hpp"
#include "UI/Animation/ExplosionEffect.hpp"
#include "Engine/GameEngine.hpp"
#include "Engine/Group.hpp"
#include "Engine/IScene.hpp"
#include "Engine/LOG.hpp"
#include "Scene/PlayScene.hpp"
#include "Turret/Turret.hpp"
#include <random>
#include "Engine/LOG.hpp"
#include "Engine/Allegro5Exception.hpp"
#include "Engine/Point.hpp"
#include <allegro5/bitmap.h>
#include <allegro5/allegro5.h>
#include <allegro5/allegro_primitives.h>
//#include "Resources.hpp"
int numb;
SoldierEnemy::SoldierEnemy(int x, int y) : Enemy("play/walkingzombie/walkingzombie-0.png", x, y, 10, 20, 5, 5) {
// TODO: [CUSTOM-TOOL] You can imitate the 2 files: 'SoldierEnemy.hpp', 'SoldierEnemy.cpp' to create a new enemy.
}
void SoldierEnemy::Update(float deltaTime){
Enemy::Update(deltaTime);
//int off = this->offset;
Rotation = 0;
numb++;
if(numb % 2 == 0){
this->off++;
if(this->off>45) this->off = 0;
}
//head.Position = Position;
// Choose arbitrary one.
std::random_device dev;
std::mt19937 rng(dev());
std::uniform_real_distribution<> dist(0.0f, 4.0f);
float rnd = dist(rng);
}
void SoldierEnemy::Draw() const {
std::string fname = "Resource/images/play/walkingzombie/walkingzombie-" + std::to_string(off) + ".png";
ALLEGRO_BITMAP* bmp = al_load_bitmap(fname.c_str());
if (!bmp) throw Engine::Allegro5Exception(("failed to load image: " + fname).c_str());
Engine::LOG(Engine::INFO) << "Loaded Resource<image>: " << fname;
al_draw_tinted_scaled_rotated_bitmap(bmp, Tint, Anchor.x * GetBitmapWidth(), Anchor.y * GetBitmapHeight(),
Position.x, Position.y, Size.x / GetBitmapWidth(), Size.y / GetBitmapHeight(), Rotation, 0);
}
Editor is loading...
Leave a Comment