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
Чаадаев Алексей Константинович
3 laba
Commits
6288178d
Commit
6288178d
authored
2 weeks ago
by
Чаадаев Алексей Константинович
Browse files
Options
Download
Patches
Plain Diff
config.h minor changes
parent
88e5ad6e
main
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/Entities/Entities.cpp
+1
-1
Sources/Entities/Entities.cpp
config.h
+29
-17
config.h
with
30 additions
and
18 deletions
+30
-18
Sources/Entities/Entities.cpp
+
1
−
1
View file @
6288178d
...
...
@@ -140,7 +140,7 @@ bool Particles::next_animation() { //false когда конец анимаци
sf
::
IntRect
rect
=
m_sprite
.
getTextureRect
();
if
(
rect
.
left
==
m_sprite
.
getTexture
()
->
getSize
().
x
)
{
return
false
;
}
if
(
m_counter
%
config
::
ENEMY_BLINKING
_FRAMES_GAP
==
0
)
{
if
(
m_counter
%
config
::
ANIMATION
_FRAMES_GAP
==
0
)
{
rect
.
left
=
(
rect
.
left
/
(
rect
.
width
)
+
1
)
*
rect
.
width
;
m_sprite
.
setTextureRect
(
rect
);
}
...
...
This diff is collapsed.
Click to expand it.
config.h
+
29
−
17
View file @
6288178d
...
...
@@ -8,6 +8,7 @@ namespace config {
// Общее:
const
unsigned
int
FRAME_RATE_LIMIT
=
60
;
// Меню:
const
sf
::
Vector2f
BUTTON_SIZE
=
{
250
,
100
};
const
size_t
BUTTON_FONT_SIZE
=
static_cast
<
size_t
>
(
BUTTON_SIZE
.
y
/
1.5
f
);
...
...
@@ -19,19 +20,30 @@ namespace config {
const
char
BUTTON_TEXT_MEDIUM
[]
=
"Medium"
;
const
char
BUTTON_TEXT_HARD
[]
=
"Hard"
;
const
char
BUTTON_TEXT_EXIT
[]
=
"Exit"
;
// Игра:
const
sf
::
VideoMode
GAME_VIDEO_MODE
{
1080
,
720
};
const
char
EASY_GAME_TITLE
[]
=
"Level: Easy"
;
const
char
MEDIUM_GAME_TITLE
[]
=
"Level: Medium"
;
const
char
HARD_GAME_TITLE
[]
=
"Level: Hard"
;
// Вероятности
const
float
EASY_GAME_ENEMY_RATIO
=
0.0
f
;
const
float
MEDIUM_GAME_ENEMY_RATIO
=
0.04
f
;
const
float
HARD_GAME_ENEMY_RATIO
=
0.07
f
;
const
float
EASY_IP_SPAWN_PROBAB
=
0
;
const
float
MEDIUM_IP_SPAWN_PROBAB
=
0.005
;
const
float
HARD_IP_SPAWN_PROBAB
=
0.02
;
// Размеры объектов
const
float
ROOM_SIZE
=
50
;
const
float
GAME_ENEMY_SIZE
=
ROOM_SIZE
*
0.7
;
const
float
GAME_FOOD_SIZE
=
ROOM_SIZE
*
0.2
;
// Пакмэн:
const
float
GAME_PACMAN_SIZE
=
ROOM_SIZE
*
0.8
;
const
float
GAME_INVIS_POTION_SIZE
=
ROOM_SIZE
*
0.35
;
// Кнопки
const
sf
::
Keyboard
::
Key
KEY_LEFT
=
sf
::
Keyboard
::
A
;
const
sf
::
Keyboard
::
Key
KEY_RIGHT
=
sf
::
Keyboard
::
D
;
const
sf
::
Keyboard
::
Key
KEY_UP
=
sf
::
Keyboard
::
W
;
...
...
@@ -42,35 +54,32 @@ namespace config {
const
sf
::
Keyboard
::
Key
KEY_KILL_ENEMY
=
sf
::
Keyboard
::
Q
;
const
sf
::
Keyboard
::
Key
KEY_GAME_PAUSE
=
sf
::
Keyboard
::
P
;
//Дополнительно:
const
float
GAME_INVIS_POTION_SIZE
=
ROOM_SIZE
*
0.35
;
const
size_t
INVIS_POTION_DURATION
=
300
;
//ticks
const
size_t
START_BLINKING_TIME
=
160
;
//ticks
const
size_t
BLINKING_GAP_DURATION
=
20
;
//ticks
const
float
EASY_IP_SPAWN_PROBAB
=
0
;
//INVIS_POTION
const
float
MEDIUM_IP_SPAWN_PROBAB
=
0.005
;
const
float
HARD_IP_SPAWN_PROBAB
=
0.02
;
// Размеры в инвентаре
const
float
CELL_SIZE
=
GAME_PACMAN_SIZE
*
1.5
;
const
float
CELL_FRAME_THICKNESS
=
1
;
const
float
INVENTORY_WIDTH
=
CELL_SIZE
*
4
;
const
float
INVENTORY_HEIGHT
=
CELL_SIZE
*
1.33
;
const
float
INVETORY_FRAME_THICKNESS
=
1
;
const
size_t
INVENTORY_FONT_SIZE
=
static_cast
<
size_t
>
(
INVENTORY_HEIGHT
/
4.5
f
);
const
size_t
ENEMY_KILL_COUNT_FOOD
=
50
;
// Размеры меню паузы
const
float
PAUSE_POP_UP_WIDTH
=
config
::
GAME_VIDEO_MODE
.
width
*
0.25
*
1.5
;
const
float
PAUSE_POP_UP_HEIGHT
=
config
::
GAME_VIDEO_MODE
.
height
*
0.25
;
const
size_t
PAUSE_POP_UP_FONT_SIZE
=
static_cast
<
size_t
>
(
PAUSE_POP_UP_HEIGHT
*
0.25
);
const
float
PAUSE_POP_UP_FRAME_THICKNESS
=
1
;
// Предметы в инвентаре:
const
size_t
INVIS_POTION_DURATION
=
300
;
//в тиках
const
size_t
START_BLINKING_TIME
=
160
;
const
size_t
BLINKING_GAP_DURATION
=
20
;
const
size_t
ENEMY_KILL_COUNT_FOOD
=
50
;
const
size_t
ENEMY_BLINKING
_FRAMES_GAP
=
3
;
const
size_t
ANIMATION
_FRAMES_GAP
=
3
;
// Цвета:
#if IS_LIGHT == 1:
// Базовые
const
sf
::
Color
BUTTON_COLOR_TEXT
{
0
,
0
,
0
};
const
sf
::
Color
BUTTON_COLOR_FILL
{
180
,
180
,
180
};
const
sf
::
Color
BUTTON_COLOR_SELECTION
{
255
,
180
,
180
};
...
...
@@ -84,17 +93,19 @@ namespace config {
const
sf
::
Color
GAME_COLOR_ROOM
{
255
,
255
,
255
};
const
sf
::
Color
GAME_COLOR_WALL
{
0
,
0
,
0
};
const
sf
::
Color
GAME_FOOD_COLOR
{
0
,
200
,
100
};
const
sf
::
Color
GAME_ENEMY_COLOR
{
255
,
50
,
0
};
// Инвентарь
const
sf
::
Color
CELL_COLOR
=
sf
::
Color
{
255
,
255
,
255
,
255
};
const
sf
::
Color
CELL_OUTLINE_COLOR
=
sf
::
Color
{
0
,
0
,
0
};
const
sf
::
Color
INVENTORY_COLOR
=
sf
::
Color
{
230
,
230
,
230
,
225
};
const
sf
::
Color
INVENTORY_OUTLINE_COLOR
=
sf
::
Color
{
20
,
20
,
20
};
const
sf
::
Color
INVENTORY_COLOR_TEXT
{
0
,
0
,
0
};
// Меню паузы
const
sf
::
Color
PAUSE_POP_UP_COLOR
=
sf
::
Color
{
255
,
255
,
255
};
const
sf
::
Color
PAUSE_POP_UP_OUTLINE_COLOR
=
sf
::
Color
{
0
,
0
,
0
};
#else:
// Базовые
const
sf
::
Color
BUTTON_COLOR_TEXT
{
255
,
255
,
255
};
const
sf
::
Color
BUTTON_COLOR_FILL
{
0
,
0
,
0
};
const
sf
::
Color
BUTTON_COLOR_SELECTION
{
50
,
50
,
100
};
...
...
@@ -108,14 +119,15 @@ namespace config {
const
sf
::
Color
GAME_COLOR_ROOM
{
0
,
0
,
0
};
const
sf
::
Color
GAME_COLOR_WALL
{
0
,
0
,
255
};
const
sf
::
Color
GAME_FOOD_COLOR
{
0
,
200
,
100
};
const
sf
::
Color
GAME_ENEMY_COLOR
{
255
,
50
,
0
};
// Инвентарь
const
sf
::
Color
CELL_COLOR
=
sf
::
Color
{
0
,
0
,
0
,
255
};
const
sf
::
Color
CELL_OUTLINE_COLOR
=
sf
::
Color
{
0
,
0
,
255
};
const
sf
::
Color
INVENTORY_COLOR
=
sf
::
Color
{
0
,
0
,
0
,
150
};
const
sf
::
Color
INVENTORY_OUTLINE_COLOR
=
sf
::
Color
{
0
,
0
,
255
};
const
sf
::
Color
INVENTORY_COLOR_TEXT
{
255
,
255
,
255
};
// Меню паузы
const
sf
::
Color
PAUSE_POP_UP_COLOR
=
sf
::
Color
{
0
,
0
,
0
,
255
};
const
sf
::
Color
PAUSE_POP_UP_OUTLINE_COLOR
=
sf
::
Color
{
0
,
0
,
255
};
#endif
...
...
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