Commit 89bede51 authored by Tim Scheiber's avatar Tim Scheiber
Browse files

more turrets

parent c0f8960d
Pipeline #3410 failed with stage
in 5 minutes and 16 seconds
{
"Transform": {
"scale": {
"x": 0.3,
"y": 0.3,
"z": 0.3
}
},
"Model": {
"aid": "model:drone"
},
"Shadowcaster": {
},
"Movement": {
"beats_per_step": 1,
"distance_per_step": 1,
"step_time_percentage": 0.2,
"off_beat_threshold": 0.0
},
"FixedPath": {
"pause_between_steps": 1,
"wait_beats": 1
}
"Shooting": {
"spawn_offset": 1,
"pause_between_shots": 1
},
"Killable": {
"radius": 1
}
}
......@@ -10,9 +10,8 @@ dummy
##########| |#
##########| |#
##########| |#
##########| <p> |#
##########| |#
##########| |#
##########| <@> |#
##########| > < |#
##########| |#
##########| ! |#
##########|-------|#
####################
\ No newline at end of file
......@@ -17,13 +17,13 @@
"blueprint": "dummy_ceiling",
"solid": true
},
"p": {
"@": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "player"
},
"G": {
"!": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
......@@ -94,6 +94,66 @@
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"a": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"b": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"c": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"d": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "moving_turret"
},
"e": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"f": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"g": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"h": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"i": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
},
"j": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "static_turret"
}
}
}
......@@ -143,7 +143,7 @@ namespace phase_shifter::gameplay {
shooting.target_direction *= -1;
}
if(closest_dist <= shooting.attack_radius) {
if(shooting.attack_radius >= 0 && closest_dist <= shooting.attack_radius) {
shooting.idle = false;
} else {
shooting.idle = true;
......
......@@ -32,8 +32,8 @@ namespace phase_shifter::gameplay {
mirrage::ecs::Entity_manager& _entity_manager;
const Beat_system& _beat_system;
const float trigger_distance_shooting = 20.f; // radius around players the turrets have to be in in order to shoot
const float trigger_distance_despawn_bullets = 30.f; // radius around players the bullets have to leave in order to despawn
const float trigger_distance_shooting = 40.f; // radius around players the turrets have to be in in order to shoot
const float trigger_distance_despawn_bullets = 50.f; // radius around players the bullets have to leave in order to despawn
void do_movement(Beat_state& beat);
void do_fixed_path_movement(Beat_state& beat);
......
......@@ -21,7 +21,7 @@ namespace phase_shifter::level {
{
_entities.register_component_type<gameplay::Rigid_body_comp>();
_spawners.emplace("p", [&](const Tile& tile, const glm::vec3& position) {
_spawners.emplace("@", [&](const Tile& tile, const glm::vec3& position) {
mirrage::ecs::Entity_facet player =
_entities.entity_builder(tile.spawns).position(position).create();
auto playerhandle = player.handle();
......@@ -56,12 +56,14 @@ namespace phase_shifter::level {
glm::rotate(sun_dir, glm::vec3(0, 0, 1)) * 40.f);
});
//basic turrets
//turret targeting the player
_spawners.emplace("0", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 0;
shooting.attack_radius = 20;
shooting.pause_between_shots = 2;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}})});
......@@ -70,6 +72,7 @@ namespace phase_shifter::level {
.create();
});
//turret shooting North
_spawners.emplace("1", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -82,6 +85,7 @@ namespace phase_shifter::level {
.create();
});
//turret shooting North-East
_spawners.emplace("2", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -94,6 +98,7 @@ namespace phase_shifter::level {
.create();
});
//turret shooting East
_spawners.emplace("3", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -106,6 +111,7 @@ namespace phase_shifter::level {
.create();
});
//turret shooting South-East
_spawners.emplace("4", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -118,6 +124,7 @@ namespace phase_shifter::level {
.create();
});
//turret shootin South
_spawners.emplace("5", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -130,6 +137,7 @@ namespace phase_shifter::level {
.create();
});
//turret shooting South-West
_spawners.emplace("6", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -142,6 +150,7 @@ namespace phase_shifter::level {
.create();
});
//turret shooting West
_spawners.emplace("7", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -154,6 +163,7 @@ namespace phase_shifter::level {
.create();
});
//turret shooting North-West
_spawners.emplace("8", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
......@@ -180,12 +190,12 @@ namespace phase_shifter::level {
.create();
});*/
//turret rotating counter-clockwise
_spawners.emplace("<", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 0;
shooting.rotation_per_step = -360.f / 16.f;
shooting.max_rotation = -1;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}})});
......@@ -194,12 +204,12 @@ namespace phase_shifter::level {
.create();
});
//turret rotation clockwise
_spawners.emplace(">", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 0;
shooting.rotation_per_step = 360.f / 16.f;
shooting.max_rotation = -1;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}})});
......@@ -207,6 +217,163 @@ namespace phase_shifter::level {
})
.create();
});
//special turrets
_spawners.emplace("a", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.rotation_per_step = 360.f / 16.f;
shooting.max_rotation = -1;
shooting.set_patterns(
{gameplay::Bulletpattern({{0, 0}, {90, 0}, {180, 0}, {270, 0}})});
});
})
.create();
});
_spawners.emplace("b", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 180;
shooting.set_patterns({gameplay::Bulletpattern(
{{0, 0}, {25, -8}, {-25, 8}, {50, -8}, {-50, 8}})});
});
})
.create();
});
_spawners.emplace("c", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 0;
shooting.rotation_per_step = 15;
shooting.max_rotation = 30;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {20, 0}, {-20, 0}})});
});
})
.create();
});
_spawners.emplace("d", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Fixed_path_comp& fixed_path) {
fixed_path.update_path({180});
});
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 270;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}})});
});
})
.create();
});
_spawners.emplace("e", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 135;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {25, 0}, {-25, 0}})});
});
})
.create();
});
_spawners.emplace("f", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 225;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {25, 0}, {-25, 0}})});
});
})
.create();
});
_spawners.emplace("g", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 180;
shooting.rotation_per_step = 10;
shooting.max_rotation = 20;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}})});
});
})
.create();
});
_spawners.emplace("h", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.rotation_per_step = 360.f / 16.f;
shooting.max_rotation = -1;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0},
{20, 0},
{-20, 0},
{120, 0},
{140, 0},
{100, 0},
{240, 0},
{260, 0},
{220, 0}})});
});
})
.create();
});
_spawners.emplace("i", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.rotation_per_step = -360.f / 16.f;
shooting.max_rotation = -1;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0},
{20, 0},
{-20, 0},
{120, 0},
{140, 0},
{100, 0},
{240, 0},
{260, 0},
{220, 0}})});
});
})
.create();
});
_spawners.emplace("j", [&](const Tile& tile, const glm::vec3& position) {
_entities.entity_builder(tile.spawns)
.position(position)
.post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 0;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0},
{45, 0},
{90, 0},
{135, 0},
{180, 0},
{225, 0},
{270, 0},
{315, 0}})});
});
})
.create();
});
}
auto Level_system::update(const mirrage::util::Time& time) -> void {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment