Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,170 --> 00:00:02,690
In the last video, we set up the animations for our character.
2
00:00:02,690 --> 00:00:05,840
However, as you can see, it still doesn't feel fun to control.
3
00:00:05,870 --> 00:00:10,400
There are some easy tweaks we can do to make the character feel fun in a platformer game.
4
00:00:10,760 --> 00:00:17,060
The first thing is something that isn't quite obvious, but we want to make a 2D or a 2d 3D hybrid game,
5
00:00:17,060 --> 00:00:21,500
and we don't want to allow our character to walk backwards or forward, just left and right.
6
00:00:21,500 --> 00:00:23,600
And in terms of the inputs, this is fine.
7
00:00:23,600 --> 00:00:25,220
We cannot walk back and forward.
8
00:00:25,220 --> 00:00:30,230
However, physics and other things can still push us back or forward, and this is very problematic.
9
00:00:30,230 --> 00:00:34,280
If we built our game around the assumption that our character is always on the same lane.
10
00:00:34,580 --> 00:00:40,010
To demonstrate that, I can just go here and add a sphere shape.
11
00:00:40,620 --> 00:00:44,340
And I want to drag this on the same lane as the character.
12
00:00:45,260 --> 00:00:46,010
Back here.
13
00:00:46,010 --> 00:00:52,010
So the character walks into the sphere, not directly in the middle, but kind of at a side angle.
14
00:00:52,010 --> 00:00:53,450
And you can see that.
15
00:00:54,320 --> 00:00:54,530
Hmm.
16
00:00:54,530 --> 00:00:54,830
Okay.
17
00:00:54,830 --> 00:00:56,300
This is too much in the middle.
18
00:00:56,360 --> 00:00:57,470
A little bit more forward.
19
00:00:59,080 --> 00:01:01,000
This kind of pushes us forward, right?
20
00:01:01,000 --> 00:01:06,970
So you can see I walk in here and the physics push us forward, and now we're off our original lane.
21
00:01:06,970 --> 00:01:10,150
And this is very problematic with the kind of game we want to make.
22
00:01:10,150 --> 00:01:15,340
However, there is a very easy solution and this is something we want to apply not just for the player,
23
00:01:15,340 --> 00:01:17,410
but also for all of the enemies.
24
00:01:17,410 --> 00:01:22,930
So we want to go to blueprints characters, not the player, but actually the action base.
25
00:01:22,930 --> 00:01:25,390
Again, because we want to apply this to everybody.
26
00:01:25,420 --> 00:01:26,470
Open it up.
27
00:01:28,330 --> 00:01:31,420
If it doesn't show the full blueprint, open the full blueprint editor.
28
00:01:31,690 --> 00:01:38,590
And we want to go to the character movement component because again, this is a component made by Unreal
29
00:01:38,590 --> 00:01:43,240
Engine that has a lot of functionality built in already that controls the movement of our character.
30
00:01:43,240 --> 00:01:48,670
And on the right side in the details panel, we just have to look for constrain and it's going to show
31
00:01:48,670 --> 00:01:50,590
us constrain to plane.
32
00:01:50,590 --> 00:01:52,390
And we want to turn this on.
33
00:01:52,390 --> 00:01:56,470
So this will force our character to always stay on the same plane that we set.
34
00:01:56,470 --> 00:02:00,520
And we also have to give it a direction for the plane constraint normal.
35
00:02:00,520 --> 00:02:03,580
Because if it's just 000, it's not going to do anything.
36
00:02:03,580 --> 00:02:07,600
We have to set the direction in which we want to lock the movement.
37
00:02:07,600 --> 00:02:10,930
And you can see here if we for example.
38
00:02:11,900 --> 00:02:13,670
Select this sphere.
39
00:02:13,820 --> 00:02:16,250
We don't want to move on this axis.
40
00:02:16,250 --> 00:02:16,460
Right.
41
00:02:16,460 --> 00:02:21,170
You can see here on the bottom right, the green axis is the one that is moving.
42
00:02:21,170 --> 00:02:25,310
So we want to prevent movement on the y axis the green axis.
43
00:02:25,310 --> 00:02:30,410
And this means here on the y we just have to put in 1.0 and 1.0.
44
00:02:30,410 --> 00:02:33,590
In this case just means active and zero means inactive.
45
00:02:33,590 --> 00:02:38,120
So we don't apply any constraint to the x and the z only to the y.
46
00:02:38,120 --> 00:02:41,690
And this is a very important setting for 2D and 2D 3D hybrid games.
47
00:02:41,690 --> 00:02:43,280
So let's try it out.
48
00:02:43,930 --> 00:02:46,210
I can now go start the game.
49
00:02:46,210 --> 00:02:50,200
And even if I walk into the sphere, well, we have a weird angle again, just like this.
50
00:02:50,200 --> 00:02:51,010
Like before.
51
00:02:51,780 --> 00:02:54,750
And I'm not being pushed forward or backward.
52
00:02:54,780 --> 00:03:01,050
I rather just stop in place and this is exactly what I want, so nothing can push us forward or backward.
53
00:03:01,050 --> 00:03:05,910
We are certain that we're always going to be on the same lane, and we can build our levels around that.
54
00:03:06,270 --> 00:03:09,720
Now we can just select the sphere, hit delete on the keyboard, get rid of it.
55
00:03:09,720 --> 00:03:13,890
And another issue that isn't quite apparent happens if we walk to the edge of the map.
56
00:03:14,410 --> 00:03:18,370
Once we are here, you can see that we don't just fall down.
57
00:03:18,370 --> 00:03:21,670
We kind of awkwardly, slowly go downwards.
58
00:03:21,670 --> 00:03:26,830
And this happens because our character is using a capsule component.
59
00:03:26,830 --> 00:03:32,200
And this is the standard thing that most game engines do because this is good if you go up slopes,
60
00:03:32,200 --> 00:03:34,960
if you go up stairs, it's just the best shape to use.
61
00:03:34,960 --> 00:03:39,280
However, for these kind of retro platformer style games, it feels very unresponsive.
62
00:03:39,280 --> 00:03:41,860
If you just kind of slide down on ledges.
63
00:03:41,860 --> 00:03:43,870
There is a setting we can change easily though.
64
00:03:43,870 --> 00:03:47,710
To fix this and again, we want to go to the character movement component.
65
00:03:47,710 --> 00:03:53,050
And again, we can do this for everybody, not just the player, for all of the action charts and look
66
00:03:53,050 --> 00:03:54,550
for floor.
67
00:03:54,940 --> 00:03:57,160
And it's going to show the.
68
00:03:57,880 --> 00:04:00,760
Use flat base for floor checks.
69
00:04:01,340 --> 00:04:02,630
Variable here.
70
00:04:02,630 --> 00:04:07,910
And for floor checks like this, it's basically just going to ignore the capsule and just use a square.
71
00:04:07,910 --> 00:04:10,100
And this will fix the situation we just had.
72
00:04:10,100 --> 00:04:13,010
So we can just turn it on, compile and save.
73
00:04:13,010 --> 00:04:14,930
And if I do the same thing now.
74
00:04:15,480 --> 00:04:21,870
And now at the edge you can see that we don't slowly go down, but once we hit the threshold, we just
75
00:04:21,870 --> 00:04:22,830
fall down immediately.
76
00:04:22,830 --> 00:04:27,300
And this is how it is in most of these old, uh, 2D kind of games.
77
00:04:27,300 --> 00:04:31,200
This doesn't come without trade offs, though, because now we implement stairs or slopes.
78
00:04:31,200 --> 00:04:36,420
The movement gets a bit awkward, but we don't plan on using them in this game, so it's kind of a trade
79
00:04:36,420 --> 00:04:36,570
off.
80
00:04:36,570 --> 00:04:40,290
You have to think about, depending on what kind of game you're making, if you want to use this or
81
00:04:40,290 --> 00:04:40,800
not.
82
00:04:41,350 --> 00:04:46,570
Next up we want to look at the jump speed and gravity in these Megamind clones.
83
00:04:46,600 --> 00:04:51,430
The jump is very distinct, and you have this jump that you can hold, and you have a lot of control
84
00:04:51,430 --> 00:04:53,920
over which we're going to implement in the next lesson.
85
00:04:53,920 --> 00:04:58,150
But for now, I just want to use the general settings you'd use in most platforms to make them feel
86
00:04:58,150 --> 00:05:02,050
good, and we can then tweak them to better fit this Megaman clone type of game.
87
00:05:03,060 --> 00:05:07,260
The biggest problem right now is that gravity is very low, and it kind of feels like we're jumping
88
00:05:07,260 --> 00:05:08,160
on the moon.
89
00:05:08,250 --> 00:05:13,470
So again, in the action chart, because we want to apply this to everybody, we can again go through
90
00:05:13,470 --> 00:05:14,760
the character movement component.
91
00:05:14,760 --> 00:05:18,090
And we want to look for gravity scale.
92
00:05:18,090 --> 00:05:20,430
And you can see here gravity scale is one.
93
00:05:20,430 --> 00:05:25,020
And we can just make gravity heavier for example by using three.
94
00:05:25,110 --> 00:05:27,780
So the gravity is three times as heavy.
95
00:05:28,790 --> 00:05:30,560
And I can now compile and save.
96
00:05:31,170 --> 00:05:34,920
And if we jump now, you can see that first of all, we barely lift off.
97
00:05:34,920 --> 00:05:37,620
But also we fall to the floor very quickly.
98
00:05:37,620 --> 00:05:39,390
And I like this falling feeling.
99
00:05:39,390 --> 00:05:44,520
However, the jump is too low now, so we have to adjust the jump height to fit this gravity.
100
00:05:44,760 --> 00:05:49,860
And again, in the action chart we can just look for jump velocity.
101
00:05:51,420 --> 00:05:54,810
And set this from 420 to 900.
102
00:05:54,810 --> 00:05:57,720
And these are just some values I found while prototyping.
103
00:05:57,720 --> 00:06:01,920
But I just I was just going through some trial and error, trying out different values and see how they
104
00:06:01,920 --> 00:06:03,990
feel, but this is what I ended up with.
105
00:06:04,660 --> 00:06:07,090
And please use the same while we make this game.
106
00:06:07,090 --> 00:06:11,080
But later on you can change these if you want to and again compile and save.
107
00:06:11,080 --> 00:06:15,730
We can check it out and this is a lot better, a lot more responsive already.
108
00:06:15,730 --> 00:06:20,170
We still have the same jump height we had before, but now we fall to the floor much quicker.
109
00:06:20,970 --> 00:06:22,890
Which makes the game much more responsive.
110
00:06:22,890 --> 00:06:26,910
If you try to move in the air, though, hold right or left while you're in the air.
111
00:06:26,940 --> 00:06:30,360
We actually cannot control our movement a lot.
112
00:06:30,360 --> 00:06:36,990
We're kind of locked into a jump direction once we start, once we lift off the floor and again, there's
113
00:06:36,990 --> 00:06:38,700
an easy setting we can use for this.
114
00:06:39,550 --> 00:06:41,260
Uh, in here character movement component.
115
00:06:41,260 --> 00:06:43,300
We can look for air control.
116
00:06:43,540 --> 00:06:47,530
And air control is a very low right now by default 0.05.
117
00:06:47,680 --> 00:06:52,840
If we put it to one, it would be the same amount of control we have on the ground, which is a little
118
00:06:52,840 --> 00:06:53,860
bit too much.
119
00:06:54,250 --> 00:06:59,770
And usually I just go for a 0.7, which gives us a lot more control than before, but less than we have
120
00:06:59,770 --> 00:07:00,580
on the ground.
121
00:07:00,580 --> 00:07:03,040
Compile and save and let's try it out.
122
00:07:03,040 --> 00:07:08,080
So now even if I jump to the left, I can kind of steer against it in the air.
123
00:07:09,550 --> 00:07:13,060
And this makes platforming a lot more precise and a lot more fun.
124
00:07:14,410 --> 00:07:17,410
And these are the general settings I always use when making a platformer.
125
00:07:17,410 --> 00:07:22,300
But again, in the next lesson we're actually going to implement the iconic Megaman clone jump.
12251
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.