Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by mathilde charpiot on 10/01/2018.
- //
- #include "Boss2.h"
- #include "Game.h"
- Boss2::Boss2(EnemyType type) : Boss() {
- TextureManager &ptr1 = TextureManager::Instance();
- stance = Stance::IDLE;
- if (type == EnemyType::BOSS) {
- enemyType = type;
- orientation = Orientation::VERTICAL;
- sprites[(int) Stance::IDLE] = ptr1.getSprite(Textures::BOSS2);
- pos.x = WIN_WIDTH / 2;
- pos.y = WIN_HEIGHT * 20 / 100;
- trajectory.x = 0;
- trajectory.y = 0;
- speed = 10;
- hp = 1000;
- weapon.setWeapon(WeaponType::SPREAD, 80, 15);
- }
- }
- Boss2::~Boss2() {
- }
- void Boss2::shoot() {
- if (shootCooldown == 0) {
- switch (enemyType) {
- case EnemyType::BASIC_A : {
- shootCooldown = weapon.getCoolDown();
- weapon.shoot(orientation, pos, Side::ENEMY, BulletType::ENEMY_A);
- }
- case EnemyType::BOSS : {
- shootCooldown = weapon.getCoolDown();
- weapon.shoot(orientation, pos, Side::ENEMY, BulletType::BOSS2);
- }
- }
- }
- }
- void Boss2::updatePos() {
- if (shootCooldown > 0)
- shootCooldown--;
- if (orientation == Orientation::VERTICAL) {
- if (back == true)
- move(sf::Vector2f(1, 1));
- else
- move(sf::Vector2f(-1, -1));
- if (pos.x == WIN_WIDTH && back == true) {
- back = false;
- }
- if (pos.x == 0 && back == false) {
- back = true;
- }
- } else if (orientation == Orientation::HORIZONTAL) {
- if (back == true)
- move(sf::Vector2f(1, 1));
- else
- move(sf::Vector2f(-1, -1));
- if (pos.y == WIN_HEIGHT && back == true) {
- back = false;
- }
- if (pos.y == 0 && back == false) {
- back = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement