diff options
Diffstat (limited to 'game/enemy')
-rw-r--r-- | game/enemy/EnemyBulletSubScene.cpp | 2 | ||||
-rw-r--r-- | game/enemy/EnemyScript.cpp | 7 | ||||
-rw-r--r-- | game/enemy/EnemySubScene.cpp | 5 |
3 files changed, 6 insertions, 8 deletions
diff --git a/game/enemy/EnemyBulletSubScene.cpp b/game/enemy/EnemyBulletSubScene.cpp index 5c31f1d..ad2ca9d 100644 --- a/game/enemy/EnemyBulletSubScene.cpp +++ b/game/enemy/EnemyBulletSubScene.cpp @@ -30,7 +30,7 @@ int EnemyBulletSubScene::create(Scene & scn, int counter) { .linear_velocity = vec2 {-250, 0}, .kinematic_collision = false, - .collision_layers = {COLL_LAY_MISSILE,COLL_LAY_ZAPPER}, + .collision_layers = {COLL_LAY_MISSILE, COLL_LAY_ZAPPER}, .collision_layer = COLL_LAY_BULLET }); bullet_body.active = false; diff --git a/game/enemy/EnemyScript.cpp b/game/enemy/EnemyScript.cpp index 8cf8b80..5c03539 100644 --- a/game/enemy/EnemyScript.cpp +++ b/game/enemy/EnemyScript.cpp @@ -4,12 +4,11 @@ #include "EnemyConfig.h" #include <crepe/api/AI.h> #include <crepe/api/Animator.h> +#include <crepe/api/AudioSource.h> #include <crepe/api/BoxCollider.h> #include <crepe/api/ParticleEmitter.h> #include <crepe/api/Rigidbody.h> #include <crepe/api/Transform.h> -#include <crepe/api/AudioSource.h> -#include <crepe/api/Animator.h> #include <crepe/types.h> #include <random> using namespace crepe; @@ -86,7 +85,7 @@ bool EnemyScript::on_collide(const CollisionEvent & e) { if (e.info.other.metadata.tag == "player_bullet") { this->despawn_enemy(); } - Animator& body_animator = this->get_components<Animator>().front(); + Animator & body_animator = this->get_components<Animator>().front(); body_animator.data.col = 2; //body_animator.play(); BehaviorScript & enemy_script = this->get_component<BehaviorScript>(); @@ -115,7 +114,7 @@ void EnemyScript::shoot(const vec2 & location, float angle) { = this->get_components_by_id<BoxCollider>(bullet_pos.game_object_id).front(); bullet_collider.active = true; bullet_body.active = true; - AudioSource& audio = this->get_component<AudioSource>(); + AudioSource & audio = this->get_component<AudioSource>(); audio.play(); return; } diff --git a/game/enemy/EnemySubScene.cpp b/game/enemy/EnemySubScene.cpp index 8316db9..607b9a9 100644 --- a/game/enemy/EnemySubScene.cpp +++ b/game/enemy/EnemySubScene.cpp @@ -2,13 +2,13 @@ #include <crepe/api/AI.h> #include <crepe/api/Animator.h> +#include <crepe/api/AudioSource.h> #include <crepe/api/BehaviorScript.h> #include <crepe/api/BoxCollider.h> #include <crepe/api/CircleCollider.h> #include <crepe/api/GameObject.h> #include <crepe/api/Rigidbody.h> #include <crepe/api/Scene.h> -#include <crepe/api/AudioSource.h> #include <crepe/api/Sprite.h> #include "../Config.h" @@ -91,8 +91,7 @@ int EnemySubScene::create(Scene & scn, int enemy_counter) { .looping = true, } ); - enemy.add_component<AudioSource>(Asset("asset/sfx/bike_gun_2.ogg")).volume - = 0.1; + enemy.add_component<AudioSource>(Asset("asset/sfx/bike_gun_2.ogg")).volume = 0.1; AI & ai_component = enemy.add_component<AI>(3000); ai_component.path_follow_on(); BehaviorScript & enemy_script |