diff options
| -rw-r--r-- | game/GameScene.cpp | 2 | ||||
| -rw-r--r-- | game/enemy/EnemyBulletSubScene.cpp | 2 | ||||
| -rw-r--r-- | game/enemy/EnemyScript.cpp | 7 | ||||
| -rw-r--r-- | game/enemy/EnemySubScene.cpp | 5 | ||||
| -rw-r--r-- | game/menus/shop/ShopMenuScene.cpp | 1 | ||||
| -rw-r--r-- | game/player/PlayerBulletSubScene.cpp | 2 | ||||
| -rw-r--r-- | game/scheduler/ObjectsScheduler.h | 6 | ||||
| -rw-r--r-- | game/workers/CollisionScript.cpp | 3 | 
8 files changed, 11 insertions, 17 deletions
| diff --git a/game/GameScene.cpp b/game/GameScene.cpp index 34b0fcb..3ae64fb 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -20,8 +20,8 @@  #include "player/PlayerBulletPool.h"  #include "player/PlayerBulletSubScene.h"  #include "player/PlayerSubScene.h" -#include "scheduler/ObjectsScheduler.h"  #include "prefab/ZapperPoolSubScene.h" +#include "scheduler/ObjectsScheduler.h"  #include "workers/WorkersSubScene.h"  #include <cmath> 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 diff --git a/game/menus/shop/ShopMenuScene.cpp b/game/menus/shop/ShopMenuScene.cpp index 5ada0d3..d1ea81d 100644 --- a/game/menus/shop/ShopMenuScene.cpp +++ b/game/menus/shop/ShopMenuScene.cpp @@ -6,7 +6,6 @@  #include "../ButtonSubScene.h"  #include "../MenusConfig.h"  #include "types.h" -#include "../../Config.h"  #include <crepe/api/Camera.h>  #include <crepe/api/Sprite.h> diff --git a/game/player/PlayerBulletSubScene.cpp b/game/player/PlayerBulletSubScene.cpp index 2d237de..795747b 100644 --- a/game/player/PlayerBulletSubScene.cpp +++ b/game/player/PlayerBulletSubScene.cpp @@ -27,7 +27,7 @@ int PlayerBulletSubScene::create(Scene & scn, int counter) {  		.linear_velocity = vec2 {400, 0},  		.angular_velocity = 10,  		.kinematic_collision = false, -		.collision_layers = {COLL_LAY_ENEMY,COLL_LAY_ZAPPER}, +		.collision_layers = {COLL_LAY_ENEMY, COLL_LAY_ZAPPER},  		.collision_layer = COLL_LAY_PLAYER_BULLET, diff --git a/game/scheduler/ObjectsScheduler.h b/game/scheduler/ObjectsScheduler.h index 56d72cb..bd0701b 100644 --- a/game/scheduler/ObjectsScheduler.h +++ b/game/scheduler/ObjectsScheduler.h @@ -1,17 +1,14 @@  #pragma once - -  #include "api/Script.h"  #include <functional>  #include <vector> -  class ObjectsScheduler : public crepe::Script {  private:  	std::vector<std::function<void()>> obstacles; -	 +  	int last_boss_check = 0;  	int last_obstacle_check = 0; @@ -32,5 +29,4 @@ private:  public:  	void init();  	void fixed_update(crepe::duration_t dt); -  }; diff --git a/game/workers/CollisionScript.cpp b/game/workers/CollisionScript.cpp index 625044d..372bfec 100644 --- a/game/workers/CollisionScript.cpp +++ b/game/workers/CollisionScript.cpp @@ -49,7 +49,8 @@ bool CollisionScript::on_collision(const CollisionEvent & ev) {  		bs_panic.active = false;  		return false; -	} else if (ev.info.other.metadata.tag == "missile" || ev.info.other.metadata.tag == "enemy_bullet") { +	} else if (ev.info.other.metadata.tag == "missile" +			   || ev.info.other.metadata.tag == "enemy_bullet") {  		for (Animator & anim : animators) {  			anim.active = false;  			anim.set_anim(3); |