Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,110 --> 00:00:04,010
Now that the charge is working, and we cleaned up our blueprints a little bit, we want to implement
2
00:00:04,010 --> 00:00:07,910
the charge material flashing, which is going to make the entire thing much, much better.
3
00:00:08,360 --> 00:00:12,470
We already prepared the dynamic material from the flashing, right.
4
00:00:12,470 --> 00:00:18,530
So in the BP player, if I look for dynamic I can see the dynamic sprite material variable here.
5
00:00:18,530 --> 00:00:18,890
Right.
6
00:00:18,890 --> 00:00:21,110
We use this for the flashing when we take damage.
7
00:00:21,110 --> 00:00:24,590
But we can reuse the same functionality for the charge flashing as well.
8
00:00:24,590 --> 00:00:27,200
And just give it a different color and maybe different timing.
9
00:00:27,200 --> 00:00:31,850
And there are multiple ways we could go about this with like timers and handles and all of those things.
10
00:00:31,850 --> 00:00:35,150
But I think if we look at the IA shoot event.
11
00:00:35,740 --> 00:00:41,590
The best way of doing this would be to just use the ongoing event and to show how this works, we can
12
00:00:41,590 --> 00:00:42,760
just print string here.
13
00:00:43,510 --> 00:00:49,570
And if I go to the game now and I just hold shoot, you can see that we always print a message while
14
00:00:49,570 --> 00:00:50,890
shoot is being held.
15
00:00:51,070 --> 00:00:54,100
And since this is being triggered on every frame, the button is held down.
16
00:00:54,100 --> 00:00:58,840
We can kind of create our own timer in here and then decide when we want to flash the sprite.
17
00:00:58,870 --> 00:01:02,860
Now delete the print string and first we want to create a new function.
18
00:01:02,860 --> 00:01:05,110
So on the left side just click on functions.
19
00:01:05,790 --> 00:01:08,880
And call it handle charge flash.
20
00:01:09,270 --> 00:01:10,350
And what do we need here?
21
00:01:10,350 --> 00:01:13,020
Well, we need the elapsed time to come in.
22
00:01:13,020 --> 00:01:17,520
So here we can just select this and create a new input of type float.
23
00:01:18,760 --> 00:01:21,070
And just call it elapsed.
24
00:01:22,020 --> 00:01:23,070
And why do we need this?
25
00:01:23,070 --> 00:01:25,860
Because we want to have more control over the flashing.
26
00:01:25,860 --> 00:01:28,380
Now back on the event graph under the shoot.
27
00:01:28,380 --> 00:01:33,090
Event IA shoot, we can now just use this handle charge flash function here.
28
00:01:33,090 --> 00:01:35,010
And we connect it from ongoing.
29
00:01:35,010 --> 00:01:38,940
Very important that it's ongoing and also connect the elapsed seconds.
30
00:01:38,940 --> 00:01:44,100
And now we have access to this information inside of this function before we reach the partial charge
31
00:01:44,100 --> 00:01:44,550
threshold.
32
00:01:44,550 --> 00:01:46,230
We don't want to flash at all.
33
00:01:46,620 --> 00:01:48,810
After that we want to flash white.
34
00:01:48,810 --> 00:01:53,580
And after we reach the full charge, we want to flash blue or some different color to make it clear
35
00:01:53,580 --> 00:01:56,370
to the player that they have charged as far as they can.
36
00:01:57,190 --> 00:02:00,880
So first we want to check again if the elapsed is bigger.
37
00:02:01,000 --> 00:02:05,950
So we can just drag off here and check for greater equal then and for shooting.
38
00:02:05,950 --> 00:02:08,919
We have our, uh, partial charge time.
39
00:02:08,919 --> 00:02:09,190
Right.
40
00:02:09,190 --> 00:02:14,830
So we check for the partial charge time like this and have a branch as well here.
41
00:02:15,130 --> 00:02:19,660
So we don't want anything to flash until we reach the partial charge.
42
00:02:19,840 --> 00:02:22,780
And again, if compiling saving, we can just shortcut this elapsed here to.
43
00:02:22,780 --> 00:02:24,100
I don't like having the lines here.
44
00:02:24,100 --> 00:02:26,290
If we don't need them, just get elapsed.
45
00:02:26,290 --> 00:02:27,610
Shortcut this.
46
00:02:30,190 --> 00:02:30,730
Like this?
47
00:02:30,730 --> 00:02:31,090
Yes.
48
00:02:31,090 --> 00:02:34,210
So if this is not the case, we don't want to do anything.
49
00:02:35,670 --> 00:02:39,000
If this is the case, we actually want to start a timer.
50
00:02:39,420 --> 00:02:42,690
And this timer is just going to keep on counting up and up and up.
51
00:02:42,690 --> 00:02:46,140
And we're always going to check if it goes over a certain threshold.
52
00:02:46,140 --> 00:02:51,330
And every time it reaches that threshold we're going to play one flash and reset the timer.
53
00:02:51,330 --> 00:02:58,110
So here we can just create a new variable and call it flash timer or better charge flash timer.
54
00:02:59,250 --> 00:02:59,670
Charge.
55
00:02:59,670 --> 00:02:59,970
Flash.
56
00:02:59,970 --> 00:03:00,660
Timer.
57
00:03:01,230 --> 00:03:03,300
And set this to a float.
58
00:03:04,730 --> 00:03:07,370
And just drag it in here and set charge flash.
59
00:03:07,370 --> 00:03:08,000
Timer.
60
00:03:10,040 --> 00:03:11,060
And what do we want to do?
61
00:03:11,060 --> 00:03:15,920
Well, we want to get the current charge flash timer and add the delta seconds.
62
00:03:15,920 --> 00:03:19,280
So add and get the world.
63
00:03:19,860 --> 00:03:24,450
Delta seconds and delta seconds are related to tick.
64
00:03:24,480 --> 00:03:29,190
We're not going to go into these specifics too much, but basically this gives us the time that has
65
00:03:29,190 --> 00:03:31,200
elapsed since the last frame.
66
00:03:31,200 --> 00:03:33,660
So this basically is just a counter.
67
00:03:33,660 --> 00:03:37,080
So if one second has elapsed it's going to give us one second.
68
00:03:37,530 --> 00:03:40,710
And well of course not from one frame, but it's going to keep on counting up.
69
00:03:40,710 --> 00:03:43,890
It's basically just going to create a stopwatch in here.
70
00:03:43,890 --> 00:03:49,290
So then only if true is the case, we go here and we count up the stopwatch.
71
00:03:49,290 --> 00:03:53,190
And if this is not the case, we actually want to reset the stopwatch, right.
72
00:03:53,190 --> 00:03:57,090
So here for false we just want to set the timer to false.
73
00:03:57,090 --> 00:04:01,230
So if we haven't reached the threshold yet we just want to reset this entire stopwatch.
74
00:04:01,530 --> 00:04:02,820
And what do we want to do then.
75
00:04:02,820 --> 00:04:03,060
Right.
76
00:04:03,060 --> 00:04:04,020
So we count first.
77
00:04:04,020 --> 00:04:10,950
And then we want to check if the charge flash timer is bigger or equal than our flash interval.
78
00:04:10,950 --> 00:04:12,180
And this is something we have to create.
79
00:04:12,180 --> 00:04:17,910
Now create a new variable, not a local one, and call it charge flash interval.
80
00:04:19,300 --> 00:04:22,420
And compile save so we can set the default value.
81
00:04:22,690 --> 00:04:27,820
And now we want to set it to 0.2 which I think is a good timing for the interval.
82
00:04:27,820 --> 00:04:32,440
And now if this is true we just want to branch off here and connect.
83
00:04:33,540 --> 00:04:36,360
And then only continue if true is the case.
84
00:04:36,570 --> 00:04:38,490
And here we can then play the flash.
85
00:04:38,490 --> 00:04:44,130
And we created a function before for this on the action chart base, which we can just use in here.
86
00:04:44,130 --> 00:04:45,780
So we can just look for flash.
87
00:04:45,780 --> 00:04:48,390
And here we have the trigger flash.
88
00:04:48,420 --> 00:04:53,910
And here I think for the flash multiplier we can just use something like five to make it clearly visible.
89
00:04:53,910 --> 00:04:59,580
And the flash color for the basic flashing I just want to go to white so we can just drag up here,
90
00:04:59,580 --> 00:05:02,100
have it be all white and click on okay.
91
00:05:02,220 --> 00:05:07,260
But this alone is still not enough because we still need to reset our charge flash timer just to show
92
00:05:07,260 --> 00:05:08,040
you how this works.
93
00:05:08,040 --> 00:05:13,920
Now I can just go from here through print string and we can just print the charge flash timer.
94
00:05:13,920 --> 00:05:17,370
And because it's not being reset, it's just going to flash all the time now.
95
00:05:17,370 --> 00:05:19,350
So I can just go here and hold shooting.
96
00:05:19,800 --> 00:05:21,990
And you can see the charge timer doesn't reset.
97
00:05:21,990 --> 00:05:23,850
It is always above our interval.
98
00:05:23,850 --> 00:05:25,590
So we just keep on flashing.
99
00:05:26,150 --> 00:05:28,010
And this is a very easy step.
100
00:05:28,010 --> 00:05:29,780
We can just get rid of the print string.
101
00:05:29,780 --> 00:05:35,210
And before we play the trigger flash we can just set charge flash timer.
102
00:05:36,480 --> 00:05:40,020
Uh, set charge flash timer and just set it back to zero.
103
00:05:40,020 --> 00:05:46,110
So the stopwatch again starts from zero and has to count up again to our interval, which is 0.2.
104
00:05:46,110 --> 00:05:50,820
And this means we are flashing once every 0.2 seconds, which was our goal.
105
00:05:50,820 --> 00:05:52,020
And let's check it out.
106
00:05:52,050 --> 00:05:54,330
I can go here I can hold shoot.
107
00:05:54,980 --> 00:05:59,690
And yeah, now we are flashing every 0.2 seconds because we are properly handling our timer.
108
00:06:00,080 --> 00:06:02,060
And I think this is just a really nice effect.
109
00:06:02,060 --> 00:06:03,560
It makes our game much more readable.
110
00:06:03,560 --> 00:06:09,200
It lets us know if we are still charging and if everything is working, and now we just want to implement
111
00:06:09,200 --> 00:06:11,990
the different color for once we reach the full charge.
112
00:06:11,990 --> 00:06:18,890
So back in the BP player we could here add a branch and then again decide based on the timing if we
113
00:06:18,890 --> 00:06:21,290
should play this trigger flash or this trigger flash.
114
00:06:21,290 --> 00:06:24,950
But again, I think a better shortcut here is to just use a select.
115
00:06:25,460 --> 00:06:28,730
The flash multiplier is always going to be the same, but I want to change the color.
116
00:06:28,730 --> 00:06:34,100
So from the color I can just drag off and look for select and use the utilities select.
117
00:06:34,100 --> 00:06:36,380
And now for the condition what do we want to check.
118
00:06:36,380 --> 00:06:40,940
So we want to know if we have charged for longer than the full charge time.
119
00:06:40,940 --> 00:06:42,980
So I just want to get elapsed.
120
00:06:44,090 --> 00:06:46,310
Which we are passing in here, right?
121
00:06:46,310 --> 00:06:47,240
The elapsed.
122
00:06:47,240 --> 00:06:53,120
And I want to make sure that it is bigger or equal than our full charge time.
123
00:06:53,120 --> 00:06:57,110
And we can have this under shooting and we have the full charge time.
124
00:06:57,110 --> 00:07:02,060
Just drag this in here and then use the boolean that returns as the index.
125
00:07:03,470 --> 00:07:04,370
And now again.
126
00:07:04,370 --> 00:07:06,380
So we just can select the color now.
127
00:07:06,380 --> 00:07:10,820
So if our elapsed is bigger than charging we know that we have the full charge.
128
00:07:10,820 --> 00:07:12,260
So this is the true case.
129
00:07:12,260 --> 00:07:14,540
And here like I said I want to make it blue.
130
00:07:15,080 --> 00:07:15,710
Uh like this.
131
00:07:15,710 --> 00:07:18,740
Have it be a dark blue and click okay.
132
00:07:18,740 --> 00:07:21,440
And false is again the normal charge case.
133
00:07:21,440 --> 00:07:25,820
And here, like we had before, I just want to have a white color and click on okay.
134
00:07:27,320 --> 00:07:29,750
And now if I compile save, go back to the map.
135
00:07:29,750 --> 00:07:31,190
I'm going to hold shooting.
136
00:07:31,890 --> 00:07:33,210
You can see it flashes white.
137
00:07:33,210 --> 00:07:34,650
And now we're over the threshold.
138
00:07:34,650 --> 00:07:36,780
You can see that it flashes blue.
139
00:07:36,780 --> 00:07:38,580
It is a subtle effect.
140
00:07:38,580 --> 00:07:43,710
You can only really tell if you pay close attention, but it still makes it a lot more readable and
141
00:07:43,710 --> 00:07:45,930
advanced players can take advantage of this.
142
00:07:45,930 --> 00:07:51,300
There is one more edge case left though, and this is that if I hold the button and I get hit.
143
00:07:52,100 --> 00:07:56,360
The actual charge shot does a reset.
144
00:07:56,360 --> 00:07:58,100
So if I let go, I'm not shooting.
145
00:07:58,100 --> 00:08:02,030
But the charging animation, the flashing does not reset, right?
146
00:08:02,030 --> 00:08:05,510
So so we need to reset this charge flashing if we get hit.
147
00:08:05,840 --> 00:08:08,690
And again an easy way is to just go to the beep player.
148
00:08:08,690 --> 00:08:14,180
And in here in our handle charge flash function we don't just have this condition with elapsed is bigger
149
00:08:14,180 --> 00:08:15,440
than partial charge time.
150
00:08:15,440 --> 00:08:21,440
But we can also go into where is it was hit during charge right in the shooting in our variables.
151
00:08:21,470 --> 00:08:24,860
Get this and have a not boolean.
152
00:08:26,270 --> 00:08:28,820
And here we just want to combine these two cases right.
153
00:08:28,820 --> 00:08:30,590
So if and boolean.
154
00:08:30,950 --> 00:08:39,049
So only if this and this is true then are we allowed to proceed and look into the charge flashing.
155
00:08:39,049 --> 00:08:39,380
Right.
156
00:08:39,380 --> 00:08:41,929
So we can go here create some space.
157
00:08:42,720 --> 00:08:43,890
And compile and save.
158
00:08:43,890 --> 00:08:44,670
And let's check this out.
159
00:08:44,700 --> 00:08:50,970
Now I charge, I charge, I get hit and you can see the charge flashing stops I let go.
160
00:08:50,970 --> 00:08:52,140
I'm not shooting the bullet.
161
00:08:52,140 --> 00:08:55,110
So this is a nice edge case that we covered here.
162
00:08:55,200 --> 00:08:59,760
Our character has come quite a long way now, but I also want to add wall sliding and wall jumping.
163
00:08:59,760 --> 00:09:04,380
But to be able to do that, we need to build a small playground where we can test out these mechanics.
164
00:09:04,380 --> 00:09:09,030
So we're actually going to look into gray boxing and how to use the cube grid in the next video.
15320
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.