diff options
Diffstat (limited to 'game/player')
-rw-r--r-- | game/player/PlayerBulletScript.cpp | 2 | ||||
-rw-r--r-- | game/player/PlayerBulletSubScene.cpp | 7 | ||||
-rw-r--r-- | game/player/PlayerScript.cpp | 9 |
3 files changed, 4 insertions, 14 deletions
diff --git a/game/player/PlayerBulletScript.cpp b/game/player/PlayerBulletScript.cpp index 2bd067d..6beb9f1 100644 --- a/game/player/PlayerBulletScript.cpp +++ b/game/player/PlayerBulletScript.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <crepe/api/Camera.h> #include <crepe/api/Rigidbody.h> @@ -37,7 +36,6 @@ void PlayerBulletScript::despawn_bullet(){ } bool PlayerBulletScript::on_collide(const CollisionEvent& e){ - cout << "player bullet collision happened with " << e.info.other.metadata.tag << endl; this->despawn_bullet(); return false; } diff --git a/game/player/PlayerBulletSubScene.cpp b/game/player/PlayerBulletSubScene.cpp index 4b36387..4ad236c 100644 --- a/game/player/PlayerBulletSubScene.cpp +++ b/game/player/PlayerBulletSubScene.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include <string> #include <crepe/api/GameObject.h> @@ -37,14 +36,14 @@ int PlayerBulletSubScene::create(Scene & scn){ }); player_bullet_body.active = false; - BoxCollider& player_bullet_collider = player_bullet.add_component<BoxCollider>(vec2(60, 40)); - //player_bullet_collider.active = false; + BoxCollider& player_bullet_collider = player_bullet.add_component<BoxCollider>(vec2(30, 30)); + Asset player_bullet_asset {"asset/other_effects/crepe.png"}; Sprite & player_bullet_sprite = player_bullet.add_component<Sprite>( player_bullet_asset, Sprite::Data { .flip = {true,false}, - .sorting_in_layer = SORT_IN_LAY_PLAYER, + .sorting_in_layer = SORT_IN_LAY_OBSTACLES, .order_in_layer = 1, .size = vec2(30,0), } diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp index dc3eec3..7bc5e55 100644 --- a/game/player/PlayerScript.cpp +++ b/game/player/PlayerScript.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "PlayerScript.h" #include "../Config.h" @@ -157,25 +156,19 @@ void PlayerScript::fixed_update(crepe::duration_t dt) { } void PlayerScript::shoot(const vec2& location,float angle){ - //cout << "player shot" << endl; RefVector<Transform> bullet_transforms = this->get_components_by_tag<Transform>("player_bullet"); for(Transform& bullet_pos : bullet_transforms){ - //cout << "bullet pos x: " << bullet_pos.position.x << " y: " << bullet_pos.position.y << endl; if(bullet_pos.position.x == 0 && bullet_pos.position.y == -850){ - - //cout << "bullet found\n"; + bullet_pos.position = location; bullet_pos.position.x += 20; - //cout << "bullet pos x: " << bullet_pos.position.x << " y: " << bullet_pos.position.y << endl; Rigidbody& bullet_body = this->get_components_by_id<Rigidbody>(bullet_pos.game_object_id).front(); BoxCollider bullet_collider = this->get_components_by_id<BoxCollider>(bullet_pos.game_object_id).front(); - //bullet_collider.active = true; bullet_body.active = true; BehaviorScript& bullet_script = this->get_components_by_id<BehaviorScript>(bullet_pos.game_object_id).front(); bullet_script.active = true; return; } } - cout << "bullet not found\n"; } |