1 00:00:00,320 --> 00:00:05,100 In this video, we'll look at the files in the Starter Project for this series. 2 00:00:05,130 --> 00:00:06,420 In the course Downloads, 3 00:00:06,450 --> 00:00:10,700 you'll find something called, godot-final-game-start-project.zip. 4 00:00:10,730 --> 00:00:13,914 You want to download this and import it in Godot. 5 00:00:14,757 --> 00:00:19,114 To import a project into Godot, you open Godot first. 6 00:00:19,829 --> 00:00:23,660 Then you're going to click the Import button, on the right. 7 00:00:23,690 --> 00:00:27,600 Go to browse and I'm going to go to my downloads folder 8 00:00:27,601 --> 00:00:29,157 where I have the zip file. 9 00:00:29,414 --> 00:00:32,340 Now, I already have the project here 10 00:00:32,370 --> 00:00:34,620 so I'm not going to be importing it. 11 00:00:34,640 --> 00:00:40,114 But you can continue by creating an empty directory and importing and editing. 12 00:00:41,050 --> 00:00:47,057 But I will open this copy of the project I have prepared here. 13 00:00:47,530 --> 00:00:49,820 You will land on the 3D viewport. 14 00:00:49,850 --> 00:00:53,157 Because we don't have a main scene set in this project, 15 00:00:53,158 --> 00:00:56,060 we'll be adding it later in the series. 16 00:00:56,090 --> 00:00:59,900 This project has the same folders as the finished game. 17 00:00:59,930 --> 00:01:04,850 However, we removed many scripts and scenes from it that you will be creating. 18 00:01:04,880 --> 00:01:07,770 We did not remove all of them, though. 19 00:01:07,800 --> 00:01:11,971 One thing we want with this series is for you to go read code 20 00:01:11,972 --> 00:01:14,886 and learn how to work with it and tweak it. 21 00:01:14,887 --> 00:01:19,230 In general, learn to work with other developer's code, 22 00:01:19,430 --> 00:01:23,186 as this is a very important skill for game developers. 23 00:01:23,770 --> 00:01:26,149 To get started, open the Room folder 24 00:01:26,150 --> 00:01:28,801 and we're going to open the Test Room scene, 25 00:01:28,802 --> 00:01:31,700 in which we'll be working for the first few lessons. 26 00:01:31,730 --> 00:01:35,060 It contains a robot, a playable character, 27 00:01:35,090 --> 00:01:38,570 and a dummy enemy that's just a damaged sponge. 28 00:01:38,600 --> 00:01:41,385 You can press the F6 key to play the game 29 00:01:41,386 --> 00:01:43,386 where you will see that the character moves, 30 00:01:43,387 --> 00:01:45,614 just like in the Obstacle Course Series. 31 00:01:45,943 --> 00:01:49,570 You have hands, you can rotate around the character 32 00:01:49,600 --> 00:01:54,140 and this uses the same code as the Bats Raycast in the site-scroller. 33 00:01:54,170 --> 00:01:56,743 Then if you click, it's going to fire bullet 34 00:01:56,744 --> 00:02:02,089 and the bullet code and firing code is actually the same as the towers 35 00:02:02,090 --> 00:02:04,043 in the Tower Defense Series. 36 00:02:04,529 --> 00:02:08,820 In this video, we're going to be looking at the robot's provided code. 37 00:02:08,850 --> 00:02:11,500 I'm going to give you an overview of how it works 38 00:02:11,530 --> 00:02:15,780 because we did it slightly differently from previous series. 39 00:02:15,810 --> 00:02:21,980 I'm going to double-click the robot and there we have a couple of nodes. 40 00:02:22,010 --> 00:02:23,170 We have the robot. 41 00:02:23,200 --> 00:02:27,610 It's a Kinematic Body 2D node and this controls the character's movement. 42 00:02:27,640 --> 00:02:30,340 It also manages the character's health. 43 00:02:30,370 --> 00:02:31,820 Then you have the skin. 44 00:02:31,850 --> 00:02:35,340 The skin is a Sprite with an animation player. 45 00:02:35,370 --> 00:02:39,986 One thing we did in this series is we split the code 46 00:02:40,157 --> 00:02:43,500 for the character's movement and the code that updates 47 00:02:43,501 --> 00:02:48,429 the character's Sprite and look direction, when moving into two scripts. 48 00:02:48,430 --> 00:02:50,420 We'll see that in a second. 49 00:02:50,450 --> 00:02:52,460 Then we have the Spell Holder. 50 00:02:52,490 --> 00:02:57,420 This is very similar to the canon in the Tower Defense Series. 51 00:02:57,450 --> 00:03:03,860 It's a point that rotates around another point that we use to spawn bullets. 52 00:03:03,890 --> 00:03:06,186 If you look at the spell spawning point, 53 00:03:06,187 --> 00:03:10,100 it sent an offset from the current Spell Holder node, 54 00:03:10,101 --> 00:03:13,708 so that when you rotate the Spell Holder, 55 00:03:13,709 --> 00:03:17,414 the spinning point turns around it at a distance. 56 00:03:17,643 --> 00:03:22,500 Going to press Control Z to go back to the starting state. 57 00:03:22,530 --> 00:03:24,700 Okay, let's look at the robot's code. 58 00:03:24,730 --> 00:03:27,340 Click on the Script icon to open it 59 00:03:27,370 --> 00:03:30,580 and there you will already see that it has quite a few comments, 60 00:03:30,610 --> 00:03:33,900 so I'll let you read those if you want to get more information. 61 00:03:33,930 --> 00:03:39,380 But the primary things that this group does is managing health, 62 00:03:39,410 --> 00:03:42,114 so the character can take damage if it gets hit, 63 00:03:42,429 --> 00:03:45,256 it has a movement speed and drag factor, 64 00:03:45,257 --> 00:03:50,820 so it uses the steering equation that we saw before to move the character. 65 00:03:50,850 --> 00:03:53,340 If we go down to physics process, 66 00:03:53,370 --> 00:03:56,614 this code is basically the same movement code 67 00:03:56,615 --> 00:04:02,700 you saw already in the Ship Project, you did at the start of the course. 68 00:04:02,730 --> 00:04:05,543 You then have two functions for the character's health. 69 00:04:05,544 --> 00:04:09,809 Set health only takes care of limiting the health. 70 00:04:09,810 --> 00:04:13,843 It's going to clamp it between zero and the maximum health, 71 00:04:13,844 --> 00:04:16,780 so it's going to keep it between zero and five. 72 00:04:16,800 --> 00:04:20,860 So the health cannot go negative and cannot go above five. 73 00:04:20,890 --> 00:04:24,029 If you go down, you have the take damage function 74 00:04:24,030 --> 00:04:28,140 that is going to inflict damage to the character. 75 00:04:28,160 --> 00:04:29,900 The enemy bullets, 76 00:04:29,920 --> 00:04:34,860 the projectiles can call this function to damage the character on impact. 77 00:04:34,890 --> 00:04:39,328 First, if the health of the character is lower or equal to zero, 78 00:04:39,329 --> 00:04:41,260 it means that the character is dead. 79 00:04:41,280 --> 00:04:45,843 Actually, we can check only for the health being equal to zero 80 00:04:46,557 --> 00:04:50,643 and we don't try to take damage. 81 00:04:51,280 --> 00:04:55,414 Then we lower the health by the amount of damage 82 00:04:55,415 --> 00:05:00,380 we got through the hit and we have two conditions. 83 00:05:00,410 --> 00:05:05,500 If the health gets lower or equal to zero, we could check if it's equal to zero. 84 00:05:05,530 --> 00:05:08,260 Actually, we disable the character. 85 00:05:08,280 --> 00:05:11,514 It's a function that's going to turn off the collisions, 86 00:05:11,515 --> 00:05:14,180 turn off physics process and process. 87 00:05:14,210 --> 00:05:15,420 We just kept it simple. 88 00:05:15,814 --> 00:05:20,186 We just disabled everything we thought of at the time of writing the code 89 00:05:20,600 --> 00:05:23,929 so that the character cannot detect collisions, 90 00:05:23,930 --> 00:05:27,671 cannot be pushed by an enemy or anything like that. 91 00:05:27,786 --> 00:05:30,300 There are no more interactions. 92 00:05:30,330 --> 00:05:33,820 Then we call the die function on the skin. 93 00:05:33,850 --> 00:05:36,578 On the skin, Sprite node that we have there, 94 00:05:36,579 --> 00:05:39,740 it's just going to play the die animation in there. 95 00:05:39,770 --> 00:05:43,600 We play the Death Audio that we have down here 96 00:05:43,601 --> 00:05:49,540 in the scene dock and we hide the Spell Holder. 97 00:05:49,570 --> 00:05:53,180 This is the node that has the hands that appear in the game. 98 00:05:53,210 --> 00:05:57,380 We hide it just so that the hands are not visible when dying. 99 00:05:57,410 --> 00:05:59,371 Otherwise, if we just took damage 100 00:05:59,372 --> 00:06:02,300 but we did not die, we play the Damage Audio. 101 00:06:02,330 --> 00:06:04,814 You can find this in the scene dock as well, 102 00:06:04,815 --> 00:06:09,420 and we increase the shake intensity of the camera. 103 00:06:09,450 --> 00:06:12,540 This is a property we prepared on the camera for you. 104 00:06:12,570 --> 00:06:15,243 It will make the screen shake when you increase it 105 00:06:15,244 --> 00:06:17,220 or when taking damage. 106 00:06:17,240 --> 00:06:19,414 All right with that and the next video, 107 00:06:19,415 --> 00:06:21,700 we'll move on to the character's skin. 108 00:06:21,701 --> 00:06:22,643 See you there.