background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Базовый курс С++ Часть #93. Анимация финальных титров"

input logo icon
"videoThumbnail Базовый курс С++ Часть #93. Анимация финальных титров
Table of contents
|

Table of contents

0:00
Анимация финальных титров
0:20
Добавим состояние титров Game_Over_Show
5:47
Добавим обработку состояния Game_Over_Destroy
10:06
Вынесем логику взрывающихся шариков в класс AExplosion
15:23
Переносим код начала взрывов в Start_Explosion()
20:33
Перенесём метод Draw_Destroying() в Draw_Explosion()
22:33
Вынесем анимацию в метод Act_On_Explosion()
27:34
Popcorn_part_93_1.zip: пишем код
27:47
Вынесем класс AExplosion в свою пару файлов
30:38
Вынесем класс AsLevel_Title
31:55
Вынесем класс ALabel
33:53
Вынесем класс AFinal_Letter
35:17
Вынесем класс AsGame_Title
39:07
Popcorn_part_93_2.zip: пишем код
39:23
Отнаследуем финальную букву от AExplosion
44:35
Добавим анимацию и рисование взрывов
46:31
Смотрим в отладчике, как уничтожаются буквы
49:19
Исправим анимацию финальных титров
53:40
Добавим код для Is_Finished()
55:00
Баг: Шарики не рисуются
56:11
Баг: Шарики анимируются слишком медленно
59:10
Баг: Шарики не закрывают буквы полностью
1:00:44
Вынесем код в метод Destroy_Letters()
1:05:40
Вычислим размеры буквы
1:10:05
Баг: остаются кусочки букв
1:21:10
Добавим состояния финальной буквы
1:23:57
Исправим отрисовку буквы по состояниям
1:30:20
Вынесем код в Draw_Letter()
1:32:38
Popcorn_part_93_3.zip: пишем код
Video tags
|

Video tags

C++
c++ visual studio
Popcorn
visual studio 2019
делаем игровой движок на C++
игры на С++
изучение С++
как научиться программировать с нуля
кодим игры
курсы С++
основы c++
пишем игры
попкорн
Программирование в Windows
Программирование
С++ для начинающих
С++ за час
С++ игры
С++ лекции
С++ обучение
С++ с нуля
С++ уроки
С++
Создание игры на С++
арканоид
анимация
анимация на с++
титры
финальные титры
анимация титров
конец игры
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:00
[music]
00:00:16
we continue to make our game and now
00:00:19
that we have implemented the functionality of the
00:00:23
descending inscription end of the game, let's
00:00:26
make these letters explode in
00:00:29
much the same way as it happens in the
00:00:31
original game,
00:00:34
but here we can notice that our
00:00:36
letters are turned over and
00:00:38
transformed into monsters and then
00:00:41
explode, I propose to make it a little
00:00:43
simpler and just explode these letters without
00:00:45
turning them into monsters, but then we
00:00:49
will need to do one more thing in our game,
00:00:52
probably additionally, and
00:00:54
we now have a state that describes the
00:00:57
descent of these letters, and
00:01:02
here we have a constant in the enumeration for this
00:01:05
imago descent and
00:01:08
we also have
00:01:09
a situation describing the explosions of these letters, but
00:01:12
we lack
00:01:14
the situation that within a few
00:01:16
seconds the original game
00:01:18
shows these letters of the players in 4 seconds
00:01:21
before exploding, I propose adding
00:01:23
another state here, let's call
00:01:25
it game over show and
00:01:29
in this state, we will
00:01:32
show letters on
00:01:34
the screen for four seconds and then I need to make a
00:01:37
transition somewhere in our code to this state,
00:01:41
here is the animation method when we
00:01:46
lower these letters at some point,
00:01:48
this current type of time will reach
00:01:52
its limit, which us is now
00:01:54
equal to 6 seconds, that is, 120 frames,
00:01:59
when the current type reaches this
00:02:00
time, our coefficient
00:02:03
will become equal to one and the inscription
00:02:06
will have time to be in the same
00:02:07
place, so in principle, we can
00:02:10
use this as a transition situation to
00:02:13
another state in which we will
00:02:15
simply show these letters
00:02:17
here I will
00:02:19
add conditions, but since we can
00:02:22
come to and and the situation and for lowering the
00:02:25
inscription the end of the game and for the inscription victory,
00:02:29
then here I will need in case
00:02:33
we lowered the inscription game over the
00:02:36
go to the state show, but if we
00:02:39
lowered the inscription “victory”, I think we won’t
00:02:41
show it, but go straight to the
00:02:43
animation state, so here,
00:02:46
too, I’ll probably need some kind of
00:02:48
condition, will you make it, that is, was my
00:02:50
state equal to
00:02:55
this? I’ll lower the inscription, end of the game,
00:02:58
then I I’ll go to the display state,
00:03:05
that is, this is it, otherwise,
00:03:10
otherwise, it means we were in this
00:03:13
creation, we lowered the inscription victory, then
00:03:16
we will go to the next state
00:03:20
in this
00:03:22
game, there’s an anime, I don’t yet know what
00:03:26
we will do for this state, but
00:03:29
for now we have the inscription victory not yet animated,
00:03:31
so we will solve this problem a little later, but
00:03:34
now we need to make sure that our
00:03:36
letters, after they are shown,
00:03:38
begin to explode. Well, I think that here it would be quite
00:03:41
appropriate to
00:03:44
write the current type of time in the start variable,
00:03:48
and
00:03:50
then, being in this state, I
00:03:54
I can wait until the starting tag
00:03:57
reaches some other mark
00:03:59
during which we show the inscription and
00:04:02
when we move away sometimes the marks we
00:04:03
will start to explode the letter so in this
00:04:06
candle I will add another case
00:04:11
for the
00:04:14
game over state of the show and
00:04:19
in this state
00:04:22
if the
00:04:25
current tag
00:04:28
more than a certain interval during
00:04:32
which we are shown the inscription game over,
00:04:35
I think I will need a constant game
00:04:38
over
00:04:41
show
00:04:43
time out, we don’t have one, but we
00:04:47
will add it
00:04:49
here and
00:04:52
let us have
00:04:55
four seconds, although perhaps this is a lot,
00:04:59
but let it be
00:05:02
like this if we are in the state of
00:05:05
displaying letters and the current time
00:05:08
has exceeded this threshold value,
00:05:10
which means we all must go to another
00:05:13
state in
00:05:14
which we will
00:05:17
destroy these letters
00:05:28
game over de system and I think we can immediately
00:05:33
set a new value for the start
00:05:37
tick so that we are in this
00:05:39
state of the game it seems like the system was already
00:05:42
counting the value of the current
00:05:45
time tick from this mark, so I’ll probably immediately add
00:05:50
another case for the game award and destruction, and
00:05:56
in this state we will look
00:06:00
at the current tag and, in principle, we
00:06:03
need this inscription here, the end of the game, we
00:06:06
need queues to explode each letter,
00:06:10
that is, we need a certain periodicity, I
00:06:13
can do it like this, for example, I can
00:06:15
divide the current time into a certain interval
00:06:19
through which we will explode the
00:06:21
next letters and if the remainder of this
00:06:23
separation is equal to zero, then
00:06:25
such an event will occur once per
00:06:27
interval then there, I’ll divide this current type
00:06:32
and not just a section, I’ll take the
00:06:34
remainder of the division for a delay before the
00:06:38
explosion, the delay is live,
00:06:43
and
00:06:44
if my remainder of the division is
00:06:48
equal to zero, it means that since
00:06:52
I have this many ticks, this condition will be triggered,
00:06:53
well, let’s make this delay
00:06:56
before with an explosion, let’s say
00:07:08
fps is divided by two in half a second and
00:07:11
this way I get a condition
00:07:14
that fires every 10 frames. I
00:07:17
think that you can even sign a
00:07:19
comment like
00:07:22
this and then here, being in this
00:07:26
condition, I can already take this value of the
00:07:29
current tick and divide it by this is
00:07:33
the time for the interval and thus I
00:07:36
got how many times
00:07:39
this interval fits in this number of ticks
00:07:42
and thus essentially got
00:07:44
the number of the letter and I can use this number or rather
00:07:46
even the index to select the
00:07:49
next letter
00:07:53
let's call this destroy index
00:07:56
add this whole a variable and and I
00:08:01
will group integers from another
00:08:05
and I first group the variables
00:08:08
that take up less memory, four
00:08:10
bytes each, and then there will be variables that
00:08:12
take up eight bytes each, and thus
00:08:14
less memory may be allocated for the joint,
00:08:18
it depends on the compilation of the project, but
00:08:20
eight elements may be allocated, but in
00:08:23
case if we compile this
00:08:25
program in a special religious form, I
00:08:27
think we will do this a little later, then the
00:08:30
memory pension here will be spent on
00:08:32
representing these variables, well, in general,
00:08:35
now I will use this destroy
00:08:37
index to select the next
00:08:40
letter from the collection of our letters and
00:08:46
if this index is greater than or equal to
00:08:50
zero because the index of the nose from the sea
00:08:53
must report and at the same time this
00:08:55
index is less than but not equal to the number of
00:08:58
elements in the collection
00:09:02
for this I will call this vector me that says
00:09:08
means we are inside this collection and
00:09:11
then I can
00:09:13
refer to this call the next element
00:09:16
through a square bracket a
00:09:19
method that should destroy this
00:09:22
letter, we don’t have such a method,
00:09:25
let’s assume that we have a method
00:09:28
for destroying the
00:09:29
destroyer, do we have this index, it’s
00:09:33
no longer in the collection, that is, there are too
00:09:36
many of these ticks, that means everything we
00:09:40
have finished destroying the last letter,
00:09:43
here I can go to the next state, the
00:09:47
next state in this case
00:09:49
will be
00:09:51
finished because from this destruction we
00:09:55
will go here and from this village,
00:10:05
well, basically, all that remains is to
00:10:08
add a method for destroying a letter to
00:10:12
our
00:10:14
final letter, this will be obviously a
00:10:17
public method
00:10:18
that will not return anything,
00:10:31
well, here in this method there is no need to
00:10:35
destroy our side in the same way as we
00:10:38
do when destroying our monsters, but
00:10:42
our
00:10:47
monsters have a quick method, this
00:10:52
method calculates the position and size of the
00:10:56
area in which the balls will explode
00:10:58
and then with all his exploding
00:11:01
balls he sets a random position, a
00:11:04
random interval size and
00:11:07
turns them on exploding, after which these
00:11:10
balls seem to explode themselves and all
00:11:13
that the monsters do is in his animation method
00:11:17
the act of destruction,
00:11:21
he goes over each exploding
00:11:25
ball and makes to animate it,
00:11:27
it checks whether the
00:11:30
animation of the next ball has finished, and when
00:11:32
all the balls have completed their animation, it is
00:11:35
erased and considered missing. In principle,
00:11:38
we would need to repeat the same thing for
00:11:41
our final letter, and I think that
00:11:44
the best option would be to remove the
00:11:47
functionality of exploding balls from
00:11:50
monsters in a separate class and then
00:11:53
use this functionality for
00:11:56
our
00:12:00
Fine Summer and
00:12:03
for this I think the best option
00:12:06
would be to take out the
00:12:08
functionality of these balls and
00:12:11
inherit the monster from it because
00:12:14
exploding balls are like
00:12:16
the functionality of a monster, we’ll just have it
00:12:19
encapsulated in a separate
00:12:20
class, let’s give a class that explosions are different,
00:12:23
let's call x springs,
00:12:35
but since the functionality of this
00:12:37
class should not be accessible
00:12:39
from the outside, it will all be protected and
00:12:43
we will inherit from this class the class of
00:12:47
our monster, and
00:12:49
I will make the inheritance public,
00:12:53
thus all protected methods from
00:12:56
this class x let's say they remain
00:12:59
protected but already inside the monster class
00:13:02
and then it will be in this class I will transfer the
00:13:05
collection of exploding balls and
00:13:11
we will need another method that will
00:13:14
create these balls correctly now,
00:13:16
as far as I remember, we have our monster
00:13:21
in the constructor of that monster, we create
00:13:25
all the balls at once we use
00:13:27
the constructor vector with the number of
00:13:31
elements and this means that when creating a
00:13:33
vector, that is, when creating a collection of
00:13:36
balls, all elements
00:13:39
inside this collection will be created, this is done
00:13:41
because we store instances of
00:13:44
objects here, they are pointers to an object in the heap,
00:13:47
but in general for us this means that
00:13:49
kvass t-x later, it should be its own
00:13:53
constructor of mine, we will place a protected
00:13:56
section, this constructor cannot be
00:13:59
called from the outside, that is, it will not be possible to
00:14:00
create just an object of type x, but
00:14:03
this constructor can be called in
00:14:06
the context of a derived class, and we
00:14:09
will not even call it explicitly, it will be
00:14:11
called itself when an
00:14:13
object of the monster class is created,
00:14:15
but
00:14:17
then I can implement a separate constructor here
00:14:22
to
00:14:25
initialize these exploding
00:14:27
balls in it,
00:14:40
I will take this tit aliza tion from the monster constructor
00:14:43
and implement it in the
00:14:47
initialization list of this expo class,
00:14:51
and here we need a constant, now this is a
00:14:54
constant it’s unknown inside this class,
00:14:57
I’ll take it from here and
00:15:02
add it here, why could it already be in the
00:15:05
private section of
00:15:07
this class, and
00:15:09
thus we have a collection of
00:15:13
exploding balls here that turned out to be placed
00:15:15
in a separate class, if I’m
00:15:17
compiling this file now, then most likely everything is
00:15:20
compiled because there
00:15:21
were no different points here, but this is not enough,
00:15:25
we also need to move all the functionality
00:15:27
that operates with these balls into
00:15:30
this class, for this I
00:15:34
will transfer this collection of balls to a private section and
00:15:37
now the code that the monster had
00:15:41
no longer has access to these balls
00:15:43
because they are in the private
00:15:46
section of the base class and this gives us
00:15:50
a hint about which lines of code
00:15:53
need to be transferred from the monster to the base
00:15:57
class x let’s say I think that probably
00:15:59
this entire destroy method can be transferred to the
00:16:03
explo press class although no, not all of it here
00:16:06
we are modifying the state of the monster
00:16:08
which we don’t have in this class x,
00:16:11
let’s put it and it shouldn’t be here, we
00:16:14
update the account, so at least
00:16:17
these two lines will remain, but everything
00:16:20
else should probably be taken into a new
00:16:22
method, but since this method will
00:16:24
already be in the context of the class a x
00:16:27
later then here it will no longer be to complete
00:16:29
construction, that is, not destruction, but
00:16:31
rather just the beginning of explosions, so I
00:16:35
would add a method here that I would
00:16:36
call start expo and
00:16:55
this method I will transfer everything that
00:17:01
we have in this ondestroy method
00:17:03
from here we take it
00:17:06
here we transfer and where we took it from,
00:17:12
I will call the start x method, since
00:17:17
we have a monster from the inheritance of the class and x,
00:17:22
we will put this method
00:17:24
is already in the context of this
00:17:27
monster class, that is, this is a method of this class,
00:17:29
so I can safely call you here
00:17:31
without specifying burnem the name of the class
00:17:33
or the name of the object, that is, it is considered
00:17:36
as a monster method, and now we need
00:17:40
to work this code, by the way, this
00:17:43
check of the state of the monster is
00:17:47
inappropriate here in the context of this class, so
00:17:49
I will return it back
00:17:52
here, probably before the start x is set,
00:17:59
and
00:18:00
all I have to do is pass it
00:18:03
somehow the width and height, as well as
00:18:06
the beginning of the rectangular area inside
00:18:08
which the balls will explode and all
00:18:10
that, I think that we can probably
00:18:13
not even bother with transferring these
00:18:15
coordinates and immediately transfer the
00:18:18
rectangular area here;
00:18:22
our monster should probably
00:18:25
have some this is your monster
00:18:28
correct I can pass this monster track
00:18:31
for example via the link here and
00:18:35
use this rectangle
00:18:38
to get its size and position
00:18:41
then here in this method I will accept a link
00:18:45
to rect which will describe the
00:18:48
rectangle of the area in which
00:18:50
explosions occur
00:18:56
I will add drag by the head sleep file and
00:19:00
then I can
00:19:02
the width of the area, by the way, it will already be
00:19:05
reduced to real pixels, that is,
00:19:08
everything will already be in this and the rio rect is
00:19:10
represented by real pixels, the name does not
00:19:13
need to be multiplied by the global scale,
00:19:14
so instead of this expression I
00:19:16
can take the right edge of this area and
00:19:21
subtract it from it is the left edge and
00:19:24
thus I get the width, all that
00:19:27
remains for me is to divide by 2 to
00:19:30
get half the width and
00:19:34
I will do the same with the height, I from the bottom edge
00:19:38
because it is larger, subtract the
00:19:40
top, this is a smaller value and
00:19:44
divide it all by 2 and we have it will turn out to be
00:19:47
half the height, but I can get the position by X, and
00:19:55
I can get this position multiplied by the scale
00:19:58
by referring to the data member elevator and by
00:20:03
the Y it will be the top
00:20:07
and this rectangle allowing us to
00:20:11
get all the necessary coordinates
00:20:12
then this edge transformation can be
00:20:15
removed, maybe the left is already an integer
00:20:17
value and
00:20:20
similarly, top is also an integer value,
00:20:24
that’s all, the studio doesn’t give us red dots here, which
00:20:27
means that it looks like there are
00:20:30
no errors in this method and we still have a couple of
00:20:34
other errors due to the fact that we are
00:20:36
monsters when drawing and when animating
00:20:39
we turn to the collection of these exploding
00:20:42
balls, but now this collection
00:20:44
is in the private section of class x,
00:20:48
despite the fact that the monster
00:20:50
inherits from this class, everything that
00:20:53
is in the private section is not
00:20:55
directly accessible to the monster and this is not a bug,
00:20:59
it is a feature that allows us to build
00:21:01
correct inheritance hierarchies classes,
00:21:04
that is, these balls are the
00:21:07
functionality of the class that deals with
00:21:09
explosions, so these
00:21:12
balls must be operated and this class is a
00:21:15
derived class, so I
00:21:18
can
00:21:22
implement this already in the basic course,
00:21:25
here
00:21:29
I will transfer a copy of this method here, then
00:21:33
I have the name of the class, but here this name is
00:21:36
already I would change it because here in the
00:21:39
context of this class x later, but we’re not talking
00:21:41
about destruction anymore, we’re talking about exploitation
00:21:44
about explosions, so I’ll do / x here
00:21:48
later and
00:21:57
I would call this method here,
00:22:02
but why do we need a method that calls
00:22:06
a method, so I can instead / completed
00:22:10
call the method / x let’s put it
00:22:21
and then the method
00:22:23
that we call drones is being built, I
00:22:27
can remove
00:22:28
now we have such functionality in the
00:22:31
base class and
00:22:33
I can do the same with this
00:22:36
method, but this method
00:22:39
also modifies the state of the monster, so we
00:22:44
can’t transfer it completely it will work out, but I can
00:22:45
move this part that
00:22:47
only operates with balls, so I’ll
00:22:50
copy this and
00:22:53
since we traditionally have a meta tag from
00:22:57
before drawing, here I’ll also
00:23:00
leave the drawing method below and put the
00:23:03
current method above and
00:23:11
also rename it
00:23:13
ikt x put but somehow
00:23:18
this tonic won’t work out very well later, it works during
00:23:22
explosions and
00:23:23
I’ll add this method to
00:23:27
the header file and
00:23:32
change the class name,
00:23:35
well, it’s excellent, it’s clear that we’ll
00:23:39
probably need to return this value
00:23:41
that we accumulate here due to the fact
00:23:44
that I use the operator and equals
00:23:46
then for each iteration I apply to this
00:23:50
Boolean variable the result that the
00:23:53
function from finish will return and if at
00:23:55
least one ball here returns falls then we
00:23:59
will have falls here for everyone, this means
00:24:02
that we have not finished yet and only when
00:24:04
all calls return true then this
00:24:07
operation will not change the value this
00:24:10
variable will remain true and so we
00:24:12
will return it as a result of the destruction of
00:24:15
all balls,
00:24:17
but for this the method must have a Boolean
00:24:20
return
00:24:23
and
00:24:25
then I can call this method already
00:24:29
here, and
00:24:32
even within this condition, what
00:24:37
if
00:24:38
act on explosion, that is, if everything there
00:24:42
completed successfully then we will go to the
00:24:45
state of the missing monster, let's
00:24:47
see what we will have to compile here.
00:24:54
There is one remark about the fact that I
00:24:57
refer to the says method on vectors, which
00:25:00
returns an unsigned value and we
00:25:02
compare it with the signed value, but it
00:25:05
seems that this is the only remark and this
00:25:08
means that For us, the
00:25:10
process of moving the functionality of monsters into a
00:25:15
separate class was successful, well, at
00:25:18
least from a compilation point of view,
00:25:20
let's see if
00:25:22
the monster will explode, if it explodes, then
00:25:24
functionally everything is fine with us too,
00:25:26
and we didn’t break anything in the process of
00:25:30
such refactoring, a
00:25:37
monster appeared, a
00:25:41
monster explodes
00:25:45
inscription it's going down, well, it's growing,
00:25:49
just in case, I'll add this screenshot here so
00:25:52
that this inscription is at hand,
00:25:56
well, that's good, it means that we
00:25:59
managed to move some of the functionality
00:26:02
from one class to another. Previously, we
00:26:04
took out, as it were, an entity located
00:26:07
inside an entity and it was easier to do
00:26:11
because it was immediately clear what belonged to what,
00:26:13
but this time we took out
00:26:15
exactly the functionality of this monster,
00:26:18
which we were able to present as a
00:26:19
separate class. In principle, this can be
00:26:21
done with almost any class and
00:26:23
any functionality can also be put
00:26:25
into separate classes, but once again it’s
00:26:28
not better than this to do because after all, this is an
00:26:30
extra waste, it complicates the architecture of
00:26:33
our project, I recommend doing this
00:26:34
only when we need to repeat the
00:26:37
same functionality in different
00:26:40
entities, which is why we put
00:26:42
everything here in a separate class and
00:26:44
explosion in order to apply
00:26:47
it later the same inheritance is like this, but for
00:26:52
our final letters so that it also
00:26:55
explodes a lot, but before
00:26:57
doing that, I would like a little A3 factory,
00:27:01
our code here in this lecturer’s file
00:27:05
already has a lot of entities
00:27:07
or Peppy’s trace has probably grown over
00:27:11
more than a thousand lines it’s a lot
00:27:15
to navigate in such a file, it wo
00:27:17
n’t be easy, so I would put it all in a
00:27:20
separate couple of files, but before we
00:27:22
do that, we need a certain slice of our
00:27:25
project, which you could use to check
00:27:27
whether you were able to correctly move the
00:27:30
functionality of explosions into a separate
00:27:33
class, so we’ll pause now and
00:27:35
now it’s your turn to take the
00:27:37
functionality of explosions into a separate class
00:27:40
and put x and make sure that the monster
00:27:43
then continues to explode when
00:27:45
destroyed
00:27:46
so that we can use
00:27:49
the functionality of the explosm class to
00:27:52
explode our final letters,
00:27:56
we need to connect here the source
00:28:00
file in which this code is located but
00:28:03
connecting the monsters here in the level seems
00:28:07
to be not entirely correct, but a
00:28:09
better solution would be to put
00:28:11
this class in a separate pair of files and
00:28:14
connect it here in the monsters and here in
00:28:18
this level, well, since we’re going to put the
00:28:21
classes in separate pairs of files,
00:28:23
let’s do it at the same time and we’ll take the same
00:28:26
extra kvass from here, they’re already more
00:28:29
formed than me, but we’ll start
00:28:31
with ex later, but I’ll take this name without a
00:28:35
prefix, create a filter here and
00:28:39
move it from here to monster’s so that
00:28:43
it’s in alphabetical order here, and I
00:28:47
’ll add a couple of cpi files here
00:28:54
pi and
00:29:00
header file
00:29:07
I’ll take
00:29:13
this class from the monster and
00:29:17
take the corresponding code already in the
00:29:19
file type
00:29:22
[music] I
00:29:31
’ll correct the initialization list and in
00:29:35
order for everything to work here I think that it
00:29:36
will be enough for us to connect our
00:29:38
config
00:29:44
I’ll only compile this chain file but the
00:29:48
studio says that we need x to
00:29:52
xii in the floor and
00:29:53
then this means that we need this
00:29:57
class, which we already have in a
00:29:59
separate pair of files,
00:30:02
to connect here, well then instead of
00:30:05
the config and connect it, we
00:30:07
compile there are
00:30:10
no errors and we have kvass and explosion
00:30:15
in our own own bar of files
00:30:17
and now I can
00:30:20
connect this file to the
00:30:24
monster instead of x on xii in the floor, connect
00:30:28
x is put and thus our monster
00:30:31
will get this functionality and
00:30:33
compiled only this file chain and there are
00:30:37
no errors, now let's take out the
00:30:41
hash from the level file this kvass for in
00:30:46
a title that describes a sign with the
00:30:49
number of a new level and
00:30:52
I will add a filter, I
00:30:56
will move it here within this
00:30:59
filter screen and it took the last
00:31:02
place according to the alphabet
00:31:19
I added a couple of files now it
00:31:23
will move here and I gave that one along with this
00:31:27
listing
00:31:38
and
00:31:40
I will take the cat from me pi file and
00:31:44
transfer it to my own
00:31:47
hippie style file, we
00:31:50
will correct the initialization list and
00:31:55
here in order for this to flow throughout the computer
00:31:59
we will need a kvass label so I
00:32:03
think that we will also need to take out this one and
00:32:07
where is it by the way, this and
00:32:10
logic and
00:32:13
mind In our info panel, we will need to
00:32:17
take this kvass out of the information panel into a
00:32:19
separate pair of files, then I will take
00:32:21
this label,
00:32:24
create a filter,
00:32:30
add a couple of files,
00:33:02
and
00:33:03
now the class and label have moved to their own pair of
00:33:08
files, and
00:33:09
I think that to compile it, it will be
00:33:13
enough to connect our config
00:33:19
I compiled only this chain file,
00:33:23
it compiled and successfully, you know
00:33:26
that now I can connect this label
00:33:31
here in our new file required, then
00:33:35
this is a lie and we will get
00:33:37
the functionality from the config and the
00:33:40
functionality of this label is compiled
00:33:43
only by this file, there are no errors and here we have
00:33:47
more and this class moved its
00:33:51
own pair of files, but it seems that’s
00:33:54
not all, and in our level, I
00:33:58
think we can find out this file class
00:34:01
and also move its
00:34:03
own pair of files, so I’ll
00:34:06
add a filter
00:34:12
and a
00:34:20
park of files
00:34:55
here, I think it will be enough for us
00:34:56
config
00:35:02
we compile only this file,
00:35:05
there are no errors, well then this tape file
00:35:09
will be connected here in our
00:35:12
left, well,
00:35:16
I think that the game title also
00:35:20
probably needs to bring out its own
00:35:22
couple of files since we have such refactoring here,
00:35:35
I’ll add a couple of files
00:35:56
and we’ll have this game toy coupon dinner along with
00:35:59
my
00:36:00
transfer so I'll take it
00:36:03
along with the class,
00:36:10
and the cat we'll take asti where is flava
00:36:27
here we need the adept's config file
00:36:30
so I think that if we
00:36:34
connect fine it's by the way poured it in here
00:36:38
connected I'll take it from here and
00:36:43
connect it here
00:36:50
compile this file,
00:36:52
there are no errors and then I can connect the
00:36:55
game title of our level and in theory this
00:36:59
will be enough to compile
00:37:03
no, it’s not
00:37:04
enough we also need a label
00:37:08
in the info panel
00:37:19
we compile the whole project is
00:37:25
missing connection level title
00:37:30
oh well yes game title and level title
00:37:47
and the whole project Having compiled and it seems
00:37:51
great, we have almost the most
00:37:54
large-scale refactoring in recent
00:37:56
times and I think that at least
00:37:59
these three pairs of files can be combined into
00:38:02
their own section, I would call it
00:38:04
Lego,
00:38:10
I will add a left lattice
00:38:25
and here I will transfer the
00:38:27
Lego itself yes, this is
00:38:31
level to it all, well, everything seems to be in principle,
00:38:36
we could
00:38:38
also build
00:38:41
some kind of hierarchy from these virtual directories, but for now I think
00:38:44
it will be enough and we
00:38:47
compile this, we launch it,
00:38:50
well, for now everything works,
00:38:59
well, in principle, the animation works, the
00:39:02
monsters float this means that everything
00:39:05
seems to be working correctly for us and at this
00:39:07
point we will take another pause and
00:39:10
now it’s your turn to put the
00:39:12
rx plugin class into separate pairs of files, the pecked
00:39:16
title label class and also the class with the final
00:39:20
letter and title title, and now that
00:39:24
we have the functionality of explosions is already
00:39:26
designed as a separate class in
00:39:29
its own pair of files, we can
00:39:32
connect this functionality
00:39:34
for the letters that will explode
00:39:38
here final, that is, here we do not need to
00:39:42
do the same as we treated
00:39:45
our monsters, namely from inheriting a
00:39:49
class from class x pause
00:39:54
for in order for this class to be
00:39:56
available here, I will connect it to the places in the config,
00:40:00
it will already pull up the config and all those types
00:40:04
that we need for compilation, now
00:40:06
our final letters class has
00:40:10
the opportunity to start explosions, animate
00:40:14
these explosions and draw explosion balls,
00:40:16
but in order for this to work for us you need
00:40:19
to call these functions in the corresponding
00:40:21
places of the file methods, well, let's
00:40:24
start with the first method that
00:40:28
launches explosions and
00:40:30
for our final there is no then we have the
00:40:34
destroy method which starts these explosions
00:40:37
so here I call the start method,
00:40:40
how complicated it is now this is also a method of this
00:40:45
class because we inherited it from
00:40:48
the base one, but to this method we need to pass
00:40:52
the rectangle in which the
00:40:53
area of ​​​​these explosions is located, and here we need to
00:40:57
either
00:40:59
define the rectangle as a data member in the traditional way for us
00:41:02
and fill it with parameters, but since
00:41:05
this letter
00:41:07
will not move independently, then probably there is no point
00:41:09
in defining the line of this rectangle, I
00:41:11
can make it right here and
00:41:17
pass it to this method by first
00:41:20
filling the
00:41:23
left edge with values, I will have this position in x
00:41:26
mind, and by the way, you can take this entire
00:41:29
structure,
00:41:32
this will be
00:41:35
the top edge of
00:41:46
the frame, I will get it by adding the width we
00:41:50
have here width, but our final letter doesn’t have a
00:41:53
width, well, we probably should have
00:41:57
passed it here, and I would have passed the width
00:42:02
and height as the
00:42:03
last parameters, and since we
00:42:06
need them here as
00:42:07
an integer, it sees it as a
00:42:11
kind of
00:42:14
hate and immediately equated them to some
00:42:18
value, well for example, how our letters
00:42:20
are indented by 16 game pixels,
00:42:23
this is where I can immediately set their sizes
00:42:27
to 16 game pixels and then
00:42:32
creating instances of these fine only, then I
00:42:36
can use the same code
00:42:37
that we already create
00:42:40
these files give it
00:42:42
here in the show method because these two
00:42:46
additional parameters will automatically
00:42:48
receive their sizes,
00:42:50
in general I
00:42:55
will add these two variables to
00:43:00
the constructors but without these
00:43:04
assignments we will remove the error,
00:43:07
these assignments should be in the
00:43:09
header, in this case in the header
00:43:12
file but not in to myself and I’ll save it, then give
00:43:16
the value
00:43:19
to the data members that I have to add here, it
00:43:23
will be the width, and
00:43:38
then I can use these
00:43:40
values ​​already here, it will have to be
00:43:43
multiplied by the
00:43:45
scale of its integer numerical form
00:43:58
due to the fact that these parameters have
00:44:01
default values, I don’t need
00:44:04
additionally write them down for each
00:44:06
letter, but if some letter should
00:44:08
be about such wider, then we already have
00:44:11
the opportunity to specifically indicate these
00:44:13
values, for example for bukva it
00:44:15
will still be wider than, say, the letter g, although
00:44:19
in general, here we have
00:44:23
this letter according to the entire width of four pixels
00:44:27
is 37, so if necessary, we can
00:44:33
specify a specific value for these letters, well,
00:44:36
let's return to the task with which
00:44:39
we started, namely, we added a new
00:44:43
base class to our final letter and
00:44:46
now we need to call these methods already
00:44:49
in our final letter here we call this start x
00:44:52
when we start the
00:44:55
destruction of the letter and now we need to
00:44:58
call the animation, well, we can do this
00:45:04
in the animation method of our final letter, and
00:45:08
so the
00:45:10
last method remains, this is drawing a
00:45:15
friend x, let's call it here, but
00:45:21
really we have to call it so this
00:45:24
letter is already exploding and we should
00:45:27
either draw it or explode, but I think
00:45:30
here we can add a simple condition that
00:45:32
if
00:45:38
cousin
00:45:39
[music] explodes,
00:45:41
then the hero
00:45:43
did not draw these explosions, otherwise
00:45:51
we risk the letter as we risked before
00:45:55
then I need to add this Boolean
00:45:58
variable
00:45:59
in our class and
00:46:03
pro initialize its
00:46:06
constructors,
00:46:08
first we will have a fall because we
00:46:11
don’t explode
00:46:13
then these brackets are no longer needed, well, we
00:46:17
have used all three methods there is a
00:46:20
new base class, all that remains is to
00:46:22
set this expo node to true
00:46:27
when we start exploding
00:46:30
let’s Let's see what comes out of this,
00:46:33
and I would set a checkpoint in the
00:46:37
animation method of our inscription, here it is
00:46:40
not here, neither here we are gradually
00:46:44
lowering it with flour, but when we start
00:46:46
showing and
00:46:48
destroying them, I would look in the debugger
00:46:50
because these are new sections
00:46:52
that we have not yet We checked,
00:47:07
so the letters reached the edge and we
00:47:10
switched to the game over state. The show
00:47:13
turns on this state after we have
00:47:16
finished lowering the inscription and
00:47:20
we are waiting here until the current tag reaches
00:47:24
this mark of 40 frames. I will put a
00:47:27
control point inside the condition and this
00:47:30
point should work when we
00:47:31
play 40 frames
00:47:36
before these 40 frames have passed and we go into the
00:47:39
state of destruction and
00:47:41
restart the tick counter and
00:47:45
now we have entered the state where the system is in order and
00:47:49
we didn’t get here right away, but I will
00:47:51
put a control point inside the
00:47:53
condition and
00:47:55
in the end on the tenth frame we we came
00:47:58
here and the destroy index is 1,
00:48:01
actually we would like to start from 0, but oh
00:48:04
well, and we access the first element
00:48:07
from zero and
00:48:10
call the destroy method in our file, but
00:48:13
this is the letter o from this, that is, we have
00:48:20
this letter
00:48:23
here I calculate a rectangle that
00:48:27
looks more or less reliable and
00:48:29
start the process of explosions for this letter
00:48:32
so theoretically
00:48:35
I should start the explosion of all these letters
00:48:38
and when we start the explosion of the next
00:48:42
letter we should have exploding balls on the screen
00:48:43
instead of the letter but there are
00:48:47
none so if I remove here the
00:48:49
to destroy control point seems to
00:48:53
work but nothing is drawn, I think
00:48:57
this is due to the fact that when we
00:48:59
do no and build, we probably need to
00:49:01
order a redraw from this
00:49:04
rectangle in order for this
00:49:06
image to appear on the screen and our toolkit will call the
00:49:13
disabled track method here for this project and
00:49:18
let's see what we can do, although I
00:49:23
think that we need to do one more
00:49:26
important task here, despite the fact
00:49:30
that in the act method we order the
00:49:33
destruction of these characters, we are not
00:49:36
called anywhere with the IKT method for our final
00:49:40
letters, I can right-click mouse,
00:49:43
select the menu item file all references
00:49:47
which will find all uses of this
00:49:49
method, this kind of search does not always
00:49:52
work correctly, sometimes the studio for
00:49:55
some reason cannot find all calls of
00:49:58
this method, so you cannot rely
00:50:00
entirely on the absence of something in this
00:50:03
list, but nevertheless the studio
00:50:05
analyzed our entire project and
00:50:08
found only two lines of
00:50:10
header files and all the peppy files and
00:50:13
everything is not where this method is not called, well, in
00:50:17
principle it’s probably so, but we need it
00:50:20
here while the destruction of letters from
00:50:24
this method is in progress, the act of
00:50:26
calling ICT methods for each letter and
00:50:29
this This means that here we need to
00:50:32
go through each letter in a loop and
00:50:41
for this letter perform the animation method,
00:50:47
what do we have here when we finish
00:50:51
going through all the letters, we will immediately
00:50:53
go to the finish state, to be
00:50:55
honest, it’s premature because
00:50:58
most likely the animation is the last letter,
00:51:00
perhaps even the penultimate one will not be
00:51:02
finished, therefore, in an amicable way, we must
00:51:05
make a delayed transition to this
00:51:07
final state when the
00:51:10
animation itself ends and we
00:51:13
have a special method that we can
00:51:16
call for each letter
00:51:19
called from finish,
00:51:21
this will not return true or false to us if
00:51:25
the letter has finished its animation now
00:51:28
True, this method does nothing, but in
00:51:32
one I did it a little later, and here we
00:51:34
will make an algorithm that
00:51:37
will analyze
00:51:38
whether the animation has ended for all letters and
00:51:41
if so, then it will go to the
00:51:44
finish state. Here I can accumulate the result of
00:51:47
many method calls from finish into one
00:51:51
pain variable for example, let's call it
00:51:54
like this,
00:52:00
then I will apply this value here
00:52:03
using the operator and is equal to
00:52:07
this, we will have a bullet variable
00:52:13
which at the beginning of this algorithm
00:52:17
will be set to labor if at least one
00:52:22
letter returns false then this value will become
00:52:25
false and it doesn’t matter what happens next but
00:52:28
for us this will mean that not
00:52:30
all the letters have finished their animation yet, then
00:52:33
I can use a simple condition that
00:52:34
if all the letters
00:52:38
have finished their animation, then only
00:52:41
we will not go to this state, but
00:52:43
here then I probably need to note
00:52:47
that it’s time for us to go to this state
00:52:49
and I can here let’s write a corpse into the pain
00:52:52
variable,
00:52:54
which means we can
00:52:58
finish, but then here we’ll
00:53:02
write fall in to indicate that it’s still early and
00:53:06
then can I finish and all the
00:53:10
letters we’ve run out of, only then
00:53:12
this whole title, all this inscription will go to the
00:53:15
state ended
00:53:17
All that remains is to add this Boolean variable
00:53:20
here, which is why
00:53:22
we go so far to
00:53:24
put this variable,
00:53:27
hints at the fact that it
00:53:30
would probably be nice to put all this into a separate method
00:53:32
because it turns out that there is so much logic
00:53:35
in one method, but this can be done
00:53:39
a little later, but now I I would also add an
00:53:44
implementation of the method from finish for our
00:53:47
final letter, but in principle this can be
00:53:50
done now, I would like to take a look, but
00:53:54
we have a crooked x method that
00:53:57
animates all these balls of explosions in exactly the
00:54:00
same way, it calculates
00:54:03
whether the animation has ended for all the balls and
00:54:05
if ended returns a Boolean
00:54:08
result but here we ignore it and
00:54:12
thus we don’t even know that
00:54:14
the animation has ended and if we save
00:54:16
this in some data member variable
00:54:21
for example finish then I can
00:54:25
just return this result here then all I
00:54:30
have to do is add this variable here a
00:54:34
backpack or a Zerawak
00:54:36
in the constructor and
00:54:40
we have a mechanism that
00:54:42
determines the end of the explosion, that is, the
00:54:46
animation of our entire letter, and now this
00:54:50
can probably be compiled and see it
00:54:57
compiles without errors, well, let's
00:55:00
see
00:55:12
[music]
00:55:13
well,
00:55:15
something is happening, this is of course good,
00:55:19
really nothing it’s not visible and this is of course
00:55:21
bad,
00:55:24
but do we have animation to work out,
00:55:28
that is, is it launched by Destroy, something is happening there,
00:55:32
perhaps our animation method itself,
00:55:36
exploding letters, is missing an order for
00:55:39
redrawing the area in which this
00:55:41
all happens, what if I
00:55:47
save this up, let me put it here
00:55:49
just so see
00:55:53
if our animation will work if I
00:55:56
here order a redrawing of exactly the
00:55:59
same rectangle
00:56:13
and
00:56:14
here are the explosions,
00:56:16
but somehow they don’t animate too
00:56:20
slowly, I
00:56:24
think I understand why our animation
00:56:27
happens twice a second, which is exactly what
00:56:33
triggers of this condition every 10
00:56:36
frames, that is, twice a second, but it
00:56:39
turns out that we are enumerating all the letters and the
00:56:43
animation is called only when the
00:56:46
next letter is launched, and this should
00:56:48
happen to us all the time, so I
00:56:51
stella this condition like this, we will have 1 in
00:56:55
this amount ticks to trigger the
00:56:58
destruction of the next letter, but this
00:57:01
will all work on every frame so
00:57:04
that the animation works for us, but
00:57:08
the problem actually was here,
00:57:12
when we animated the next frame with
00:57:15
explosions, we needed to order the
00:57:17
redrawing of the area, but the fact is that I
00:57:19
copied and pasted this code from here Of course, it’s
00:57:23
wrong and this hints at the fact that
00:57:25
we need to initialize this rectangle as a
00:57:28
data member here and
00:57:31
use it there, that is, instead of
00:57:34
declaring this variable,
00:57:35
I’ll add a
00:57:39
data member here that will be called
00:57:45
correct, it will describe this
00:57:49
rectangular area that we here
00:57:53
we’ll initialize it at the start of destruction,
00:57:56
we’ll start explosions for it, we’ll order it
00:57:59
to redraw, and we
00:58:05
’ll also do this, and we’ll also create an animation for each frame.
00:58:09
Now, in theory, we can see
00:58:12
if our letter will explode
00:58:14
constantly, and it seems to me that
00:58:18
this is not very good; it’s interesting that
00:58:21
the compiler seems to us
00:58:26
won’t say anything, but it turns out to me that
00:58:29
this variable n finish may not get
00:58:32
a value neither here nor here if
00:58:36
these conditions did not work and we are already here, and
00:58:38
by the way, the studio says that we are
00:58:40
using zero wanna
00:58:42
change, but this prostrate and lization I
00:58:46
will do before fulfilling such a
00:58:49
condition, then give the parentheses are not needed and then
00:58:53
our Cohen finish will always have a
00:58:55
certain value either fall or in the
00:58:59
end the pipe studio still has
00:59:03
not removed this claim but
00:59:05
this is an error in the code analyzer and it has passed
00:59:10
let's see how it goes behave
00:59:13
animation of exploding letters this time, well,
00:59:25
another thing went animation, of
00:59:29
course, we don’t have enough size, I think we
00:59:32
need to do it twice as much, for example,
00:59:35
but the letters explode, by the way, I would put a
00:59:39
checkpoint here to see
00:59:41
in this method of ours the act of our game tide
00:59:46
yes whether we are in the end able to
00:59:48
finish or not and let’s give the sizes of these
00:59:53
balls we will make Arno I don’t know twice
00:59:57
probably it will be a lot of these one and a
00:59:59
half times more for 24 well
01:00:18
in principle it’s good except for the fact
01:00:21
that there is a tail left from the letter c and
01:00:24
we forgot about the first letter, well, this is
01:00:28
probably trifles and the debugger has set a
01:00:32
breakpoint on this line and this
01:00:34
means that we will go to the state
01:00:36
is over, that is, the animation is over, we
01:00:39
can finish the cue, this is great,
01:00:42
but
01:00:43
before fixing these explosions, I
01:00:47
would like to take out this code from the
01:00:50
game over destruction section from the eco method to a
01:00:55
separate method because there is too
01:00:57
much here and do it back so
01:00:59
that the destruction of letters starts from
01:01:02
index 0, they are from 1 and we start from the first one
01:01:05
because we
01:01:07
save the start tag here and
01:01:10
interrupt this section of the case and next
01:01:14
time when the act method is called and we
01:01:16
go here to the game in hell, it builds we
01:01:19
already have car and timer text, there is no text one
01:01:21
more, and here our current tag will be
01:01:25
one more than the starting tag, therefore
01:01:27
it will no longer be divided by an integer, that is, the
01:01:31
remainder of the division will not be equal, or
01:01:33
therefore we as if we are skipping the first
01:01:35
iteration, which is also not entirely correct, well,
01:01:38
it’s better to first remove this din’s method and
01:01:40
then solve this problem and the method
01:01:43
that destroys all our letters I would
01:01:46
call quickly ice with
01:01:56
I’ll add this method to the private section I’ll
01:02:00
move the code here and then I’ll move it
01:02:03
The method itself is a little lower, we'll take that away, and
01:02:12
in this section we'll just leave the method call,
01:02:17
then we'll need these variables that we
01:02:19
defined from above
01:02:21
already here, and
01:02:26
I can immediately set them to the correct
01:02:29
values,
01:02:37
and
01:02:41
here we need the current tag, which I
01:02:45
can pass as an
01:02:47
argument,
01:03:00
we compile,
01:03:05
no errors and in order for us to have this
01:03:09
current tag start from scratch, I can
01:03:12
generally make it simpler not to do a
01:03:15
break here when we move from this section
01:03:18
to this one and then the starting tag
01:03:21
will remain the same, but it’s true that it’s a cog, but it
01:03:25
will still be quite large and
01:03:27
honestly renner on the plan, the best
01:03:29
idea is that if suddenly we add
01:03:31
some new state between these
01:03:33
two and write code here, then we may
01:03:36
have difficult-to-detect errors,
01:03:39
so I’d better do it differently; I
01:03:42
’ll destroy this index and take into account the
01:03:46
local variable in no way in this method,
01:03:49
we will have a data member
01:03:52
in a private section
01:03:58
that will describe the index of the next
01:04:01
letter from the collection of these letters, and at the
01:04:03
start I will make this index equal to minus 1.
01:04:09
We can reset it to zero in the constructors so that in
01:04:13
the studios we don’t get stuck with turtle doves,
01:04:15
but in the method itself which includes
01:04:19
the animation, I will write a
01:04:24
separate value -1 there, then the presence
01:04:28
of this minus 1 will mean that we have
01:04:31
not yet displayed the letter
01:04:37
and then here I can check
01:04:40
additionally that from the predot index
01:04:42
is equal to minus 1 key or the remainder of dividing the
01:04:46
tick by ender is equal to zero then this
01:04:50
means that we need to select the next letter
01:04:52
and then we will go into this method with a scarron
01:04:55
tick equal to one and we will get into this layer
01:04:58
only because you build the
01:05:01
index is equal to 1 then here you need to
01:05:03
insert a condition or here we will no longer
01:05:07
calculate this destroy index and
01:05:09
just it I’ll immediately increase it by one and
01:05:13
from the very first time it will be equal to
01:05:14
zero, that is, the normal value for the
01:05:17
index, and if this completion index is
01:05:20
greater than or equal to zero less than the
01:05:25
number of letters, then we will use
01:05:27
this index to refer to the vector and order
01:05:30
the destruction of the letter a otherwise we will assume
01:05:33
that we have all gone through all the letters, so
01:05:35
we will blow up the first
01:05:38
letter of the district a and I will assume that this
01:05:42
will be the right decision because
01:05:43
wait until the mop clears the screen and the
01:05:45
inscription slowly uses downwards, this is
01:05:47
a long time, I will look at everything together later
01:05:49
If only here then in our class, those
01:05:52
describing the letter would do something
01:05:54
so that this tip of the letter
01:05:58
c would also be erased, but it remains with us
01:06:02
because we have the same height of all letters
01:06:04
and the same width, by the way, and it is
01:06:07
obvious that this does not work for
01:06:09
special letters that don’t look
01:06:12
like the others, that’s the goal, or the core would have been
01:06:15
English for years to come, or maybe
01:06:19
some other letters, but this means that in the general
01:06:21
case, our approach of the same size in
01:06:23
height and width is not entirely suitable
01:06:25
because the characters may turn out to be of
01:06:27
some kind are non-standard, which means that
01:06:31
these width and height should be
01:06:36
different for different letters and probably the most
01:06:39
correct option would be to calculate
01:06:41
the size of this letter, for example, when we
01:06:46
draw it for the first time, and save this as the
01:06:49
length and width of the area in which the
01:06:52
letter will be located and then
01:06:54
use this when defining this
01:06:57
rectangle in which
01:06:59
explosions will occur and in order to
01:07:01
calculate the size of a text string
01:07:04
consisting of one character, we already
01:07:07
have a solution here that we applied in
01:07:09
our information panel and
01:07:11
by the way, mine was then transferred to our label,
01:07:14
here it is
01:07:16
here when displaying labels containing a
01:07:20
text string like this, we call the
01:07:24
Windows function get extract and point
01:07:27
32 which calculates for us the size of the
01:07:30
rectangular area
01:07:32
necessary to display it
01:07:34
on the screen and this exchange is saved
01:07:36
here in this structure says in general I can
01:07:40
take this one line and
01:07:48
we don’t need this one anymore and
01:07:53
calculate here into the size of our text
01:07:56
string
01:07:57
for this function I need to pass a
01:08:00
pointer to the line and the pointer to the
01:08:02
line is the address of this letter
01:08:06
that we are displaying because in essence
01:08:08
it is a pointer to the line and so how
01:08:11
we use unusual strings that
01:08:14
must end with zero, but simply
01:08:17
sequences of characters and must
01:08:19
indicate the number of characters, that is, one,
01:08:22
then we can use this letter and not
01:08:24
have a separate line to
01:08:27
calculate its size or output, but this is
01:08:29
logical, then yes, it’s renaming
01:08:31
some for the top site and
01:08:35
here we have a way to calculate the size of the
01:08:39
letter and then if we calculate then I
01:08:43
will take the data member cx and store it as the
01:08:48
width
01:08:54
fathers y
01:08:56
as the height and then here I will not
01:08:59
multiply the width and height by the global
01:09:02
scale because we already have this will
01:09:05
all be calculated in real pixels, and
01:09:07
so as not to do this for each
01:09:09
letter output, we put here a simple word:
01:09:11
what if we have the size of the letter, more accurately,
01:09:15
if we don’t have the size of the letter, the
01:09:21
year of Qatar says
01:09:24
the we will calculate it all and
01:09:28
write it in this Boolean variable true
01:09:33
then we will need one more painful
01:09:36
variable thing, we have a lot of them, these
01:09:38
Boolean variables,
01:09:40
perhaps it can all be described by one
01:09:43
state, but it is not yet clear which one,
01:09:45
so let it sit for now and we must not
01:09:48
forget to reset this Boolean variable to zero in the
01:09:51
constructor
01:09:52
so that we can
01:09:55
calculate the size during the first output of this letter, let's
01:09:58
see what happens,
01:10:01
compile,
01:10:05
run,
01:10:17
but basically nothing, but
01:10:21
some pieces remain,
01:10:22
well,
01:10:24
this is probably better,
01:10:28
but it would be better,
01:10:34
we now calculate the individual
01:10:37
sizes of these areas, but these pieces,
01:10:40
and
01:10:41
by the way, the best 100 pours this
01:10:43
image into another paint
01:10:46
son
01:10:48
mask such pieces and this is the end of
01:10:52
the game and,
01:10:54
apparently, these remains
01:10:56
correspond to these
01:10:59
tilted elements because we
01:11:02
use italics here, that’s all that
01:11:05
tilted, it all came out, and
01:11:08
this is probably by the way, but in general this is
01:11:12
unexpected and I thought that
01:11:15
this function would calculate for us the size of the
01:11:18
tilted letters is correct, oh well,
01:11:21
I can just display this letter before the
01:11:24
explosion using the background color and it
01:11:27
perizat rubs this is what was there and it doesn’t
01:11:30
matter what we have left there, so
01:11:32
here in this section when we explode
01:11:36
the letters
01:11:37
if we have this the first drawing of explosions,
01:11:41
then first you need to remove the letter, that is,
01:11:45
if there is a letter,
01:11:49
then we will display it in the background color,
01:11:52
for now, for simplicity, Skopje is paying this
01:11:55
code, I will
01:11:57
leave this code here bbq ENT,
01:12:02
this is the pain variable we will
01:12:06
reset to zero here, then we need to first
01:12:10
add it here and
01:12:13
write it in the constructor its meaning
01:12:17
[music]
01:12:21
let's see what we can do to
01:12:27
compile without errors,
01:12:42
but it doesn't seem to help,
01:12:45
we still have leftovers and
01:12:47
it's honestly strange,
01:12:50
let's see what happens if we don't
01:12:54
draw these explosions and
01:12:57
I generally paint this erasure in red
01:13:00
to see if it is even
01:13:02
drawn at all or not and for simplicity I
01:13:07
will leave just one letter k and let's see
01:13:12
what we get
01:13:16
here when drawing this letter
01:13:22
I will put a control point here and
01:13:25
see what we get there
01:13:32
I will try to take a screenshot before the
01:13:36
letter starts explode I have
01:13:39
four whole seconds to do this and then
01:13:42
we’ll see what we have left there
01:13:54
I’ll save
01:13:56
the letter k here we have it
01:14:00
on the screen now we’ve entered the
01:14:03
drawing letter h CIA and we seem to be
01:14:10
drawing it all I’ll remove the control
01:14:14
point and I’ll put here is a control
01:14:16
point to see what we will have
01:14:19
on the next frame and
01:14:22
this is what we have on the next frame but I didn’t
01:14:26
have time, but what I saw on the next
01:14:31
frame is that the whole letter is displayed in
01:14:34
red except for this tail and this is
01:14:37
strange, I
01:14:40
’ll put another control point to
01:14:42
see what size the area
01:14:45
is calculated for us and let's see how this
01:14:49
area correlates with
01:14:53
the image on the screen,
01:15:03
we calculate the size and t the letter we have is
01:15:07
38 but 84 is the
01:15:13
opposition of X if we multiply
01:15:18
93
01:15:19
never this is the letter we go down
01:15:22
this is how I crop this image
01:15:27
a little so that 0 starts at
01:15:30
zeros and
01:15:35
here
01:15:39
93 is
01:15:43
and the letter itself starts a few
01:15:46
pixels further
01:15:51
if I take the width to be 38 and the height to be 84
01:15:57
by the way, what is y equal to and
01:16:01
here is 0 and it will reach us up to 135
01:16:06
multiplied by
01:16:10
3,405 that is, in our
01:16:12
screenshot 405
01:16:16
is this pixel, well, in principle, the
01:16:19
cells of the characters are normal, they turn out
01:16:22
so rectangular and from the top to the bottom they have
01:16:25
quite a lot of space like spilled so that
01:16:28
you can place all sorts of tails from
01:16:30
letters, for example, curly braces, they will be
01:16:32
larger than these letters, but this also seems to be with
01:16:35
a margin, but of course it’s too high, come on, and
01:16:40
we get an
01:16:43
area of ​​38 by 84,
01:16:51
I’ll take a
01:16:53
thin line of red color
01:16:57
38 by 84, this rectangle
01:17:04
describes this folder, and this tail
01:17:07
that comes out is exactly
01:17:10
similar this tail
01:17:14
here has a width of 5 pixels,
01:17:19
someone else we get
01:17:27
5 pixels, that’s actually why
01:17:30
our letters remain on the tail, and
01:17:33
the size of the cell in width, apparently,
01:17:36
was calculated correctly, I was
01:17:39
wrong to use this function and our
01:17:42
problem is the fact that the output position is this
01:17:45
expose which we will go into the text but for
01:17:48
some reason it does not coincide with the beginning of the letter
01:17:51
but this is basically normal this is a
01:17:53
known problem the fact is that in
01:17:55
some fonts this would coincide but for
01:17:58
Cyrillic fonts I
01:18:01
have encountered this problem and am not sure if This is not a
01:18:04
Cyrillic font, but the problem is that
01:18:06
the characters inside their cells are
01:18:08
shifted, in principle, it’s normal that the letter k
01:18:11
for this font is actually a
01:18:13
vector image and these fonts
01:18:16
that we use are called
01:18:18
true type and the characters in these fonts are
01:18:20
built at certain points we connect each
01:18:24
other with bezier curves
01:18:26
with different fastening parameters,
01:18:29
so this beautiful image
01:18:32
is actually just a set of points
01:18:34
connected to each other by lines and this
01:18:36
set, in principle, can be
01:18:38
shifted relative to its cell by
01:18:41
some distance
01:18:42
if we were to display several characters and
01:18:45
count If this function had the size of the
01:18:48
string, it would be calculated
01:18:51
accurately, but perhaps the last character did
01:18:54
not fit into this area. In general, in
01:18:57
principle, we could solve this problem,
01:18:59
but we would have to google for a long time in
01:19:02
temples to understand where
01:19:05
this offset is stored. letters, how to take it into account
01:19:08
and
01:19:09
this is somewhat beyond the scope of our
01:19:11
task, if they were making some kind of
01:19:13
text editor or graphic editor
01:19:16
where positioning is very important, well
01:19:18
then I would take up this task, but for
01:19:20
our game, in principle, this is not relevant,
01:19:22
so I will do this more simply these
01:19:27
five six pixels
01:19:29
for a distance of 38 are about one
01:19:33
tenth of the width
01:19:36
we have here, so I just
01:19:38
expand this rectangle by two
01:19:41
tenths so that it is guaranteed to
01:19:44
overlap this tail, but I will do
01:19:46
this only for the width and leave the height as it
01:19:49
is there is,
01:19:51
therefore, here, when
01:19:54
calculating the width of the letter, I will add to this
01:19:57
value another 20 percent of this, or
01:20:01
one fifth,
01:20:03
I think it’s worth signing the comments
01:20:06
that we have 120 percent of the
01:20:10
width,
01:20:11
not that this will help much in understanding the
01:20:15
problem that is happening here, well, it
01:20:17
will be at least something- then
01:20:18
[music]
01:20:21
I’ll remove the control point, turn on the explosions
01:20:25
and
01:20:27
once I comment on these remaining letters
01:20:30
to see what we get, we
01:20:33
compile and
01:20:35
look, in
01:20:52
my opinion it’s great, although there was
01:20:55
some pixel left from one letter, but
01:20:57
in my opinion it was remarkably clear that
01:20:59
I would
01:21:02
still clear it here not with red, but with
01:21:06
background color so that these letters seem to disappear
01:21:09
before the explosion and, in principle, this can already be
01:21:12
considered a solution to our problem, but to be honest,
01:21:15
I don’t like everything about our
01:21:18
final, this is precisely what we have there are
01:21:21
as many as four Boolean variables that
01:21:24
do not explicitly distribute the
01:21:26
various states of our letter among themselves. In
01:21:29
fact, I think we could describe it all by
01:21:32
enumeration and do it through a switch case
01:21:35
here using the friend method instead of
01:21:39
using these different conditions,
01:21:41
I think it’s worth doing because
01:21:43
These conditions themselves look
01:21:48
simple in principle, but the switch case will
01:21:50
look simpler and thus will
01:21:52
look more user friendly, especially
01:21:54
for novice programmers, but such
01:21:57
code will look more readable,
01:21:59
which of course is important for our program
01:22:01
if you look at what we do for
01:22:04
falling letters, then we have a state in
01:22:08
which we do nothing, and after
01:22:10
this inscription appears there and
01:22:13
we show it, and for this we have the
01:22:16
following code working here, then we
01:22:19
hide the letter,
01:22:21
whether this section works for us,
01:22:24
after which we go to mode of
01:22:27
exploding balls and wait until they
01:22:29
finish exploding, after which we
01:22:32
finish all our actions and
01:22:33
move on to the essence in a state of
01:22:35
doing nothing, but this will already be the creation of the
01:22:38
end of actions, so I can
01:22:41
describe these states
01:22:44
in the form of an enumeration
01:22:48
and
01:23:01
the first we will have is the idol of
01:23:04
nothing we don’t then we show
01:23:07
the letter
01:23:09
then we
01:23:12
hide the letter
01:23:15
then we explode and
01:23:19
go to the finish it state
01:23:22
in which we do nothing
01:23:25
I’ll add this instead of these four
01:23:29
Boolean variables and
01:23:35
initialize this state in the
01:23:38
constructor
01:23:40
okay, I’ll comment this out for now then suddenly
01:23:43
something will be useful although not will not be
01:23:45
useful and
01:23:49
from the very beginning we will
01:23:53
create a hajduk here, we don’t do anything then
01:23:59
in this method the fraction I will make a switch case
01:24:05
where, depending
01:24:08
on the state,
01:24:11
if we have it
01:24:14
there 1 went to the sector if this is
01:24:18
showing a letter
01:24:21
then we do it under this code
01:24:27
a
01:24:32
when we have finished displaying the letters,
01:24:36
we will pour the Hyde Summer state and
01:24:46
in this state we address the letter with the
01:24:52
background color and
01:24:56
we are left with the
01:24:59
explosion state
01:25:11
in which we draw an explosion,
01:25:16
then we don’t need this, and
01:25:22
in the finish state
01:25:26
we don’t do anything,
01:25:36
you can even add a
01:25:40
revenue section to in which we will throw
01:25:43
an exception, but in case
01:25:47
some new state suddenly appears here, well,
01:25:50
now it’s true that this needs to be corrected a little; in
01:25:52
principle, we could add
01:25:55
another state, the first display of a letter, in
01:25:58
which we would draw the letter and
01:26:01
calculate its size, well, we can make it
01:26:04
simpler and that’s it - leave the Boolean
01:26:06
variable,
01:26:14
which then needs to be initialized
01:26:16
in the constructor, and
01:26:23
by the way, it doesn’t seem like we don’t need
01:26:28
this state and not idol because in
01:26:30
this class we don’t have a method that included the
01:26:33
ABC button right from the very beginning,
01:26:37
it should show itself, so this
01:26:40
title not needed let's
01:26:44
start with this state and when we
01:26:47
run out of display we will need to go
01:26:50
to this hyip and give it then and actually
01:26:54
we will go to it when you call the method
01:26:56
Destroy so here I can
01:27:02
write one Destroy in the middle as the state
01:27:08
[ __ ] summer and then the next time we
01:27:14
draw, we will go into this
01:27:17
state and
01:27:19
erase the letter, but after this right we
01:27:21
then need to go to the exploding state,
01:27:24
so I
01:27:26
will go to another state here,
01:27:34
well, all that remains is to correct the method from finish,
01:27:38
which should return true if our
01:27:42
state is
01:27:44
equal to finish and
01:27:59
here we are in front of the mind, this is the finish state
01:28:10
when the explosions end, so if the
01:28:14
corpse is returned here,
01:28:17
then we will write the finish in this state,
01:28:24
the studio says that the lecturer the project is not
01:28:27
initialized,
01:28:29
well, let’s initialize it with
01:28:37
curly braces because this is a
01:28:40
structural variable,
01:28:44
well, everything looks fine
01:28:47
here, they should remove the extra ones variables and everything
01:28:52
can be compiled,
01:28:58
it compiles without errors, let's
01:29:02
see if the animation works
01:29:04
correctly and
01:29:07
I even think that it is worth putting a
01:29:10
checkpoint in the game title
01:29:15
here
01:29:26
in the destroy method for years with where
01:29:30
we finish the animation of all explosions we
01:29:33
will have to go to the finish state and
01:29:36
if we didn’t spoil anything when
01:29:39
refactoring the final letters, then this
01:29:41
checkpoint should work,
01:30:05
well, in principle, the checkpoint
01:30:08
worked, that is, we moved to the
01:30:10
finish state, but this is already the state of our game
01:30:14
Tide Go and we can use the transition
01:30:17
to this state as the end of the game and here,
01:30:20
probably, almost everything is ready for what I do
01:30:24
n’t like a little is that we
01:30:27
draw the letter using copy-paste in the background color
01:30:31
[music]
01:30:32
here or in white using the
01:30:37
same code, let’s put
01:30:39
this into a separate method,
01:30:43
which I would call
01:30:47
drawing a letter
01:30:50
drop- sheet I
01:30:52
think here we can not return anything from
01:30:55
them and
01:31:01
in this method we
01:31:04
will do this
01:31:13
I will add this method a private section
01:31:19
so this method should move to the
01:31:22
end and
01:31:25
here then we need to draw this letter with
01:31:29
two different colors white or
01:31:31
background so I can just pass
01:31:33
here a variable that will say whether
01:31:37
we draw in color or not,
01:31:41
for example, like this and
01:31:46
then whether there is income or
01:31:53
the, we draw with white color and
01:31:57
otherwise with background
01:32:17
color. Now I will call this method here, here we output in color, so we delete it, and here we output the background color, so
01:32:22
we pass fox
01:32:25
or This is also deleted,
01:32:29
well, in my opinion it has become better,
01:32:34
I think you probably don’t even have to check it,
01:32:37
and now it’s your turn to inherit the
01:32:41
final letters from the class and
01:32:44
the exploit and make sure that these letters
01:32:47
explode just like the monsters after
01:32:50
the inscription reaches the end

Description:

Самые лучшие бесплатные курсы по C++, Ассемблеру и Unreal Engine 5! Часть #93. Анимация финальных титров (Базовый курс программирования на С++) Оглавление курса на Википедии: https://ru.wikiversity.org/wiki/%D0%91%D0%B0%D0%B7%D0%BE%D0%B2%D1%8B%D0%B9_%D0%BA%D1%83%D1%80%D1%81_%D0%A1%2B%2B 00:00 - Анимация финальных титров 00:20 - Добавим состояние титров Game_Over_Show 05:47 - Добавим обработку состояния Game_Over_Destroy 10:06 - Вынесем логику взрывающихся шариков в класс AExplosion 15:23 - Переносим код начала взрывов в Start_Explosion() 20:33 - Перенесём метод Draw_Destroying() в Draw_Explosion() 22:33 - Вынесем анимацию в метод Act_On_Explosion() 27:34 - Popcorn_part_93_1.zip: пишем код 27:47 - Вынесем класс AExplosion в свою пару файлов 30:38 - Вынесем класс AsLevel_Title 31:55 - Вынесем класс ALabel 33:53 - Вынесем класс AFinal_Letter 35:17 - Вынесем класс AsGame_Title 39:07 - Popcorn_part_93_2.zip: пишем код 39:23 - Отнаследуем финальную букву от AExplosion 44:35 - Добавим анимацию и рисование взрывов 46:31 - Смотрим в отладчике, как уничтожаются буквы 49:19 - Исправим анимацию финальных титров 53:40 - Добавим код для Is_Finished() 55:00 - Баг: Шарики не рисуются 56:11 - Баг: Шарики анимируются слишком медленно 59:10 - Баг: Шарики не закрывают буквы полностью 01:00:44 - Вынесем код в метод Destroy_Letters() 01:05:40 - Вычислим размеры буквы 01:10:05 - Баг: остаются кусочки букв 01:21:10 - Добавим состояния финальной буквы 01:23:57 - Исправим отрисовку буквы по состояниям 01:30:20 - Вынесем код в Draw_Letter() 01:32:38 - Popcorn_part_93_3.zip: пишем код Popcorn_part_93_1.zip - https://drive.google.com/file/d/1e5kY6JwZj3GCSkVjvqirEp44UgvnB1bv/edit Popcorn_part_93_2.zip - https://drive.google.com/file/d/1qdftfOYH46dGaK9sb2I5C259SGsiv5Xx/edit Popcorn_part_93_3.zip - https://drive.google.com/file/d/1geRzs_gZUhNqfvnmN5Cz6uNWUqs6Mb0b/edit

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Базовый курс С++ Часть #93. Анимация финальных титров" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Базовый курс С++ Часть #93. Анимация финальных титров" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Базовый курс С++ Часть #93. Анимация финальных титров" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Базовый курс С++ Часть #93. Анимация финальных титров" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Базовый курс С++ Часть #93. Анимация финальных титров"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Базовый курс С++ Часть #93. Анимация финальных титров"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.