Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PhaseShifter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GameDevWeek
S
Sommersemester 2019
Cpp
PhaseShifter
Commits
48d8bdf1
Commit
48d8bdf1
authored
Sep 21, 2019
by
Kevin Balz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/37-enemy-types' into feature/36-level-design
parents
59b1cc9d
89bede51
Pipeline
#3411
failed with stage
in 5 minutes and 9 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
270 additions
and
12 deletions
+270
-12
assets/game_assets/blueprints/moving_turret.json
assets/game_assets/blueprints/moving_turret.json
+31
-0
assets/game_assets/level/proto.lvl
assets/game_assets/level/proto.lvl
+3
-3
assets/game_assets/tilesets/dummy.json
assets/game_assets/tilesets/dummy.json
+62
-2
src/gameplay/enemy_system.cpp
src/gameplay/enemy_system.cpp
+1
-1
src/gameplay/enemy_system.hpp
src/gameplay/enemy_system.hpp
+2
-2
src/level/level_system.cpp
src/level/level_system.cpp
+171
-4
No files found.
assets/game_assets/blueprints/moving_turret.json
0 → 100644
View file @
48d8bdf1
{
"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
}
}
assets/game_assets/level/proto.lvl
View file @
48d8bdf1
...
...
@@ -10,9 +10,9 @@ dummy
##########| |#
##########| |#
##########| |#
##########| <p> |#
##########| |#
##########| |#
##########| <@> |#
##########| > < |#
##########| |#
##########| ! |#
##########|-------|#
####################
assets/game_assets/tilesets/dummy.json
View file @
48d8bdf1
...
...
@@ -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"
}
}
}
src/gameplay/enemy_system.cpp
View file @
48d8bdf1
...
...
@@ -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
;
...
...
src/gameplay/enemy_system.hpp
View file @
48d8bdf1
...
...
@@ -32,8 +32,8 @@ namespace phase_shifter::gameplay {
mirrage
::
ecs
::
Entity_manager
&
_entity_manager
;
const
Beat_system
&
_beat_system
;
const
float
trigger_distance_shooting
=
2
0.
f
;
// radius around players the turrets have to be in in order to shoot
const
float
trigger_distance_despawn_bullets
=
3
0.
f
;
// radius around players the bullets have to leave in order to despawn
const
float
trigger_distance_shooting
=
4
0.
f
;
// radius around players the turrets have to be in in order to shoot
const
float
trigger_distance_despawn_bullets
=
5
0.
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
);
...
...
src/level/level_system.cpp
View file @
48d8bdf1
...
...
@@ -49,7 +49,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
();
...
...
@@ -84,12 +84,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
}})});
...
...
@@ -98,6 +100,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
)
...
...
@@ -110,6 +113,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
)
...
...
@@ -122,6 +126,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
)
...
...
@@ -134,6 +139,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
)
...
...
@@ -146,6 +152,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
)
...
...
@@ -158,6 +165,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
)
...
...
@@ -170,6 +178,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
)
...
...
@@ -182,6 +191,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
)
...
...
@@ -208,12 +218,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
}})});
...
...
@@ -222,12 +232,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
}})});
...
...
@@ -235,6 +245,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
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment