Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Сулимов Игорь Андреевич
Pac-Man
Commits
340c5a84
Commit
340c5a84
authored
1 week ago
by
Сулимов Игорь Андреевич
Browse files
Options
Download
Patches
Plain Diff
T
parent
29a1d505
main
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
CMakeLists.txt
+2
-1
CMakeLists.txt
include/GameContext.h
+6
-0
include/GameContext.h
include/MazeContent/Entities/DynamicEntities/Enemy.h
+1
-1
include/MazeContent/Entities/DynamicEntities/Enemy.h
include/MazeContent/Entities/DynamicEntities/IDynamicEntity.h
+1
-1
...ude/MazeContent/Entities/DynamicEntities/IDynamicEntity.h
include/MazeContent/Entities/StaticEntities/IStaticEntity.h
+1
-1
include/MazeContent/Entities/StaticEntities/IStaticEntity.h
source/Maze_Content/Entities/DynamicEntities/Enemy.cpp
+14
-0
source/Maze_Content/Entities/DynamicEntities/Enemy.cpp
source/Maze_Content/Entities/Pacman.cpp
+1
-1
source/Maze_Content/Entities/Pacman.cpp
with
26 additions
and
5 deletions
+26
-5
CMakeLists.txt
+
2
−
1
View file @
340c5a84
...
...
@@ -19,7 +19,8 @@ add_executable(pac-man
"source/Commands/ExitCommand.cpp"
"source/Commands/GameCommand.cpp"
"source/Maze_Content/Buildings/Room.cpp"
"source/Maze_Content/Entities/Pacman.cpp"
"source/Maze_Content/Entities/DynamicEntities/Enemy.cpp"
)
target_compile_definitions
(
pac-man PRIVATE
...
...
This diff is collapsed.
Click to expand it.
include/GameContext.h
0 → 100644
+
6
−
0
View file @
340c5a84
#pragma once
class
GameContext
{
public:
public:
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
include/MazeContent/Entities/DynamicEntities/Enemy.h
+
1
−
1
View file @
340c5a84
...
...
@@ -6,7 +6,7 @@ class Enemy: public IDynamicEntity {
public:
void
prepare_for_drawing
()
override
;
///@todo
void
draw_into
(
sf
::
RenderWindow
&
window
)
const
override
;
///@todo
std
::
unique_ptr
<
IDynamicEntity
>
clone
()
override
;
///@todo
std
::
unique_ptr
<
IDynamicEntity
>
clone
()
const
override
;
///@todo
void
action
()
override
;
///@todo
public:
Enemy
();
///@todo
...
...
This diff is collapsed.
Click to expand it.
include/MazeContent/Entities/DynamicEntities/IDynamicEntity.h
+
1
−
1
View file @
340c5a84
...
...
@@ -4,7 +4,7 @@
class
IDynamicEntity
:
public
IEntity
{
public:
virtual
std
::
unique_ptr
<
IDynamicEntity
>
clone
()
=
0
;
virtual
std
::
unique_ptr
<
IDynamicEntity
>
clone
()
const
=
0
;
virtual
void
action
()
=
0
;
virtual
~
IDynamicEntity
()
=
default
;
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
include/MazeContent/Entities/StaticEntities/IStaticEntity.h
+
1
−
1
View file @
340c5a84
...
...
@@ -4,6 +4,6 @@
class
IStaticEntity
:
public
IEntity
{
public:
virtual
std
::
unique_ptr
<
IStaticEntity
>
clone
()
=
0
;
virtual
std
::
unique_ptr
<
IStaticEntity
>
clone
()
const
=
0
;
virtual
~
IStaticEntity
()
=
default
;
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
source/Maze_Content/Entities/DynamicEntities/Enemy.cpp
0 → 100644
+
14
−
0
View file @
340c5a84
#include
"MazeContent/Entities/DynamicEntities/Enemy.h"
std
::
unique_ptr
<
IDynamicEntity
>
Enemy
::
clone
()
const
{
return
std
::
make_unique
<
Enemy
>
(
*
this
);
}
void
Enemy
::
action
()
{
auto
miliseconds
=
static_cast
<
size_t
>
(
m_stopwatch
.
getElapsedTime
().
asMilliseconds
());
if
(
miliseconds
<
rand
()
%
10000
)
return
;
auto
direction
=
static_cast
<
Room
::
Direction
>
(
rand
()
%
4
);
m_ptr_room
->
get_side
(
direction
)
->
enter
(
this
);
m_stopwatch
.
restart
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
source/Maze_Content/Entities/Pacman.cpp
+
1
−
1
View file @
340c5a84
#include
"MazeContent/Entities/Pacman.h"
void
Pacman
::
move
(
Room
::
Direction
direction
)
{
m_
location
->
get_side
(
direction
)
->
enter
(
this
);
m_
ptr_room
->
get_side
(
direction
)
->
enter
(
this
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets