0:02 if you're just starting your game def
0:05 Adventure or you're trying out a new
0:07 game engine it's good to start with
0:09 Basics Tod platformer game we'll create
0:13 it in goo a free and open source engine
0:14 that will allow you to create your first
0:17 Dream project we'll be touching a lot of
0:19 Concepts so stick to the very end to
0:22 collect all their badges if some of the
0:24 workflows require revision don't forget
0:26 to explore video Chapters at the bottom
0:29 of the video after each chapter you will
0:32 receive a new badge first let's install
0:35 godo visit the official website click
0:38 download latest and then godo engine
0:40 after installation you will be greeted
0:44 with this screen press new project PR
0:46 the puff and create a new directory that
0:50 will hold all your future goo projects
0:52 give your new project a name and click
0:54 create folder that way you will have a
0:57 nice structure for this and future
1:00 projects as for the renderer select
1:02 mobile option it's the best choice for
1:05 2D game click create and edit this is
1:08 the gdo main editor window here we'll be
1:10 doing all of our work as you can see
1:13 there are multiple panels and tabs which
1:16 we be discovering along the way first
1:17 thing we need to do is to create our
1:20 scene scene is a container that gathers
1:23 all the in-game components both static
1:25 and the dynamic ones as you can see here
1:27 in the top left goto gives us some
1:30 starting suggestions but I would prefer
1:32 to have a blank canvas click on other
1:35 node and from this scare window just
1:38 select default white node and click
1:40 create this will be our root of the
1:43 scene and all other components will be a
1:45 child of it that helps to keep our
1:48 project tidy before we'll start adding
1:51 child notes we need to save our scene
1:54 just click control or command s name it
1:58 main. dscn which is a godo scene format
2:01 and click save save after it's saved you
2:04 can find it here in the file structure
2:08 of a project congrats this is your first
2:11 badge today we'll create only 2D
2:14 elements so here at the top select 2D
2:17 mode and zoom into the blue border it
2:20 represents our game window our scene
2:23 will consist of three main elements
2:25 background ground blocks where our
2:28 character will be able to walk and a
2:31 character let's start with the first one
2:34 today for all the graphics I'll be using
2:36 this awesome free pack called pixel
2:38 Adventure download it from the link
2:41 below I'll take the green background
2:44 image and drag it into the goo file
2:47 system section that way it will become a
2:50 part of our project to fill the whole
2:52 background withd let's create our first
2:55 Noe click on this small plus icon in the
2:58 Sy Tab and search for texture wrecked
3:00 node click
3:03 create this component allows us to show
3:06 an image on the scene simply drag this
3:08 image from the file system to the
3:11 texture field right here that way it
3:14 shows up on the scene now I would like
3:16 to resize it to the whole size of the
3:19 screen resizing man is not a good idea
3:21 because everything may break after the
3:24 window resizes what we need to do is to
3:26 click on this small green icon at the
3:29 top and from the anchor preset select
3:32 four wrecked to learn more about Ancor
3:35 presets you can check out this video to
3:38 other small tweaks first I don't like
3:40 that this pixelated image is being
3:42 blurred to fix that here in the
3:45 inspector find the texture section and
3:48 change filter to nearest much better and
3:51 the second one instead of stretching
3:54 this image I'd like to tile it here in
3:58 the stretch mode select tile
4:01 great now now let's create a ground on
4:04 which our character will be walking for
4:06 that we'll use a GRE til set system
4:08 which allows us to easily paint our
4:11 scene objects you may recognize it from
4:14 many popular games both in the side view
4:17 and in the top down view I'll import
4:19 this terrain file to use it let's create
4:22 a new note right click on the rout
4:25 select ADD child node and search for
4:28 tile map to start drawing tiles we need
4:30 to do a onetime configuration ation of a
4:32 tile set here in the inspector click on
4:36 empty and select new tile set in this
4:39 new window on the bottom we only need to
4:42 drag our terrain image here click yes
4:44 and goto will automatically split our
4:47 tile set for us into small individual
4:50 tiles now to draw them on the scene
4:53 simply switch the tab on the bottom to
4:56 tile map select tile and start dragging
4:59 your mouse on the scene again two small
5:01 fing to make this experience better
5:03 first let's increase the size of our
5:05 tiles so that everything will be bigger
5:08 on the scene go to transform and change
5:11 scale to three and the second one if we
5:13 zoom in we can see the same problem with
5:17 smoothing out pixels go to texture and
5:20 set filter to nearest way better now is
5:22 the time for you to become a level
5:24 designer you can play with all the
5:28 available tiles and tools like paint
5:31 line or rectangle Le you can also select
5:33 multiple Tiles at once and paint them in
5:36 batches and when you make a mistake just
5:39 use an eraser to cleaned now I'll take a
5:41 second to Z my level in the meanwhile
5:43 you can leave a like under this video if
5:46 you're enjoying it so far also here is a
5:49 silver badge for you you'll learn one
5:51 more skill related to TI Maps later in
5:54 this video all right here is what I
5:56 created I think it will be a nice level
5:58 to play around remember to play some
6:00 bricks around around the scene so that
6:03 player does not fall off the map but
6:06 obviously something is missing our main
6:09 character time to create one create a
6:12 new note called character body 2D it
6:15 should be a child of root so if you made
6:18 the same mistake just drag it like that
6:20 character control needs to have two
6:23 children Sprite that will Define its
6:26 image and a collider that will Define
6:28 what touches the ground and collides
6:30 with other elements on the scene let's
6:32 start with the first one create a new
6:36 note called Sprite 2D similarly to the
6:38 background it also waits to add a
6:40 texture to it I will import this ninja
6:43 frog and set it as a Sprite texture if
6:45 you think your character should be a bit
6:49 bigger simply resize it and again just
6:51 like with all other images I'll change
6:54 the texture filter to nearest then
6:57 collider select the character body and
6:59 add a new note called Collision shape
7:02 ape 2D for now it hasn't created any
7:04 collider because we need to change a
7:07 setting here in the inspector instead of
7:11 empty go with the rectangle shape 2D
7:13 that created this blue box don't worry
7:16 it won't be visible in the game it only
7:18 visualizes to what shape will collide
7:21 with other objects resize on the bottom
7:23 Edge so that it will reflect the place
7:26 where player will be touching the ground
7:28 colliders on the sides are not that
7:30 important but you can simply resize them
7:33 to the entire frog image these are the
7:37 basics of creating Sprites good job if
7:39 you'd like to create enemies you can do
7:42 so by using the same node structure
7:44 remember to experiment with different
7:47 Collision shapes time for the very
7:50 important skill creating subscenes our
7:53 character is initially placed here in
7:56 the corner obviously not an ideal place
7:58 so I'm going to move it the problem is
8:00 that I'm not not moving the whole parent
8:03 but only the collider or the Sprite to
8:06 move everything we need to create a
8:09 subscene we can also call it a group or
8:12 a prefab if you're coming from Unity
8:14 right click on character body and select
8:18 Save branch as scene now we need to set
8:20 the location create a new folder called
8:23 scenes rename our scene as main
8:27 character and click save that did two
8:30 things first we can now find our newly
8:33 saved subscene here in the file system
8:35 and the second our few notes have been
8:38 combined into this one I can now freely
8:40 move this subject with all of its nodes
8:43 at once if you like to change anything
8:46 for this character just double click it
8:48 that will open a new tab with only this
8:51 scene contents what is really important
8:53 anything changed here will also apply to
8:56 the main scene for example I will change
8:59 the collider shape to capsule resize it
9:02 a bit and press command or contrl S now
9:05 in the main window this change is
9:07 applied that can be even more useful for
9:10 changing multiple subscenes at once for
9:13 example here I have an enemy subscene
9:16 that I placed a few times in our world
9:18 if I open it change the rotation of the
9:21 Sprite and save it you can now see that
9:23 all of the enemy instances have been
9:26 updated remember to often create
9:28 subscenes to keep your project tidy
9:31 let's try to play our game here in the
9:35 top right click run project a new window
9:36 will appear and after a second of
9:39 loading you should see your amazing game
9:42 for now we can't really do much our
9:45 character is not moving let's fix that
9:47 go to the main character scene click on
9:50 the root node and click the small ad
9:52 script icon we leave all of those values
9:55 by default but let's quickly go over
9:57 them first you select your programming
10:00 language we'll go with g script but if
10:02 you'd like to try out C check out my
10:04 other video and follow the script
10:07 alternative version shown on the screen
10:10 then select a template goo has a
10:12 built-in template for moving to the
10:15 characters which we'll use for sure and
10:18 finally set a file location and name
10:20 it's a good practice to name it the same
10:23 as the scene click create whoa as you
10:26 can see goto has switched to the script
10:28 tab if you like to go back to the editor
10:31 you can do it here this is the template
10:34 code for the character controller the
10:36 good news is that it already works and
10:39 we can test it out go to the 2D Tab and
10:42 save the scene notice that the unsaved
10:45 changes have the small star next to them
10:48 press play now our game starts the main
10:51 character starts falling and falls
10:54 through the map what's wrong the problem
10:56 is that our whole character has the
10:58 Collision remember this blue box shape
11:01 but but our ground does not the game
11:04 simply doesn't know what to collide with
11:06 the fix is very easy but requires a few
11:10 clicks select the tile map in the SC tab
11:13 then here in the inspector click on tile
11:16 set then physics layers and click add
11:19 element now go to this bottom section
11:22 select tile set tab don't mistake it
11:24 with ti map in a paint tool set paint
11:27 properties to the physics layer and
11:29 finally paint all the tiles that should
11:32 collide with the player in my case all
11:36 of the ground tiles and the rope and
11:38 that's it now when I press play our
11:40 character will start colliding with the
11:43 ground perfect to control it use
11:47 keyboard arrows and to jump press space
11:49 congratulations on creating your first
11:52 movement controller in goo before we'll
11:54 move on with a nicer movement I'd like
11:57 to quickly go back to our Sprite
11:59 appearance currently it's just stands
12:02 without any life we can easily fix that
12:05 by giving it a simple idle animation go
12:08 to the main character scene I would like
12:10 to replace this Sprite with a node that
12:13 enables animation right click on it and
12:16 select change type we'd like to change
12:20 it to the animated Sprite 2D our image
12:22 disappeared but don't worry we'll
12:25 quickly reverted in the inspector select
12:28 animation and next to the Sprite frames
12:31 click and empty and select new Sprite
12:33 frames I'd like to use this idle
12:36 animation frames which can be found in a
12:39 pack import them to godo and here in the
12:41 Sprite frames panel on the bottom click
12:45 add frames from Sprite sheet select ID
12:48 animation file here godo is asking us
12:51 how we would like to split this image in
12:54 this case I know that each frame is 32x
12:58 32 so we can enter it here alternatively
13:00 you can can also experiment with
13:02 horizontal and vertical values until the
13:05 image will be split correctly then we
13:08 need to select all the animation frames
13:10 simply click on the first one and drag
13:13 your mouse along all the others that
13:17 will create 11 frames add them now our
13:20 animation is ready to preview it click
13:23 this play button if the animation seems
13:25 a bit too slow you can increase the
13:28 frames per second value before we move
13:29 on let's let's create two other
13:32 animations that we'll use later on
13:35 jumping and running for jumping that
13:38 will be only one frame we've used before
13:40 I will just click add frame from file
13:44 and import this full image for running
13:47 we'll use this Sprite sheet go ahead
13:51 pause the video and try to add it right
13:54 now all right here is what you need to
13:57 do import running image in the Sprite
13:59 frame switch to the running animation
14:02 and press this button select the file
14:06 slice it properly select all the frames
14:08 preview the animation and change its
14:11 speed to play the animation in the game
14:13 select the default one and press the
14:16 small button that will turn on out to
14:19 playay on load that's it play the game
14:22 and enjoy how our character plays the
14:24 animation we'll work on implementing the
14:26 other animations a bit
14:30 later as promised let's get back to the
14:32 scripting as you can see our movement
14:36 works but it's quite lifeless and stiff
14:38 time to change that switch to the script
14:42 Tab and look at main character script it
14:44 is very short and quite understandable
14:47 thanks to the comments basically what's
14:49 happening is that 60 frames per second
14:52 we are doing three things first we check
14:54 if our character is not touching the
14:57 ground which means it's in the air in
15:00 such cases we we apply a gravitational
15:03 force that pulls it towards the ground
15:06 it's worth noting that in gdo the y axis
15:08 operates differently than the standard
15:11 graph convention with positive values
15:14 directed towards the bottom then we
15:16 check if player is both on the floor and
15:19 has pressed jump button in such case we
15:22 should increase the velocity towards up
15:24 and lastly we check if player is
15:27 clicking either right or left button in
15:29 such case we should change the velocity
15:32 towards either of the sides and that's
15:35 it pretty simple we'll have three tasks
15:37 here flip character right or left
15:40 depending on the movement play character
15:42 animations depending on what's Happening
15:46 and finally make walking and jumping a
15:48 bit smoother and nicer to play with
15:51 let's start with the first one if we
15:53 take a look at our animated Sprite you
15:55 can see that in the offset section there
15:57 is this nice togle to flip Sprite
15:59 graphics horizont onally we need to
16:02 toggle it in the script depending on
16:04 what was the last player velocity
16:06 direction accessing nodes and their
16:09 values in the script is very easy switch
16:11 to the script Tab and start dragging
16:14 Sprite to denote from the scene to code
16:17 like that very important just before the
16:20 mouse release hold the control key that
16:23 will create a reference that can be used
16:25 in different parts of the script now at
16:27 the very end of this function we simply
16:31 need to add two lines VAR is left that
16:33 will be a variable that will check if
16:36 player is facing the left or the right
16:38 side of the screen we know that by
16:42 checking if the velocity. x is lower
16:46 than zero if player is facing left that
16:48 means that we'd like to flip its image
16:53 type Sprite Tod flipcore H which stands
16:57 for horizontally equals is left that
17:00 should be it Run the game and notice how
17:02 our character is changing its size
17:06 depending on the movement Direction next
17:08 playing different animations now that we
17:11 have a Sprite animator reference that
17:14 will be very easy as a reminder we have
17:18 three animations default jumping and
17:21 running to change animation for example
17:25 while jumping just type here Sprite Tod
17:28 do animation equals jumping now when
17:30 whenever our character is in the air the
17:33 jumping animation starts to implement
17:36 animations for walking and sending here
17:38 is the code I will add at the very top
17:42 of our function if velocity. x is
17:45 greater than 1 or lower than minus one
17:47 we need to cover both right and left
17:51 movement then sprite td. animation
17:55 equals running else sprite td. animation
17:58 equals default remember that those
18:00 strings need to have the exact same
18:03 names as defined earlier now press play
18:06 and notice how our character is nicely
18:09 animated it even plays jump animation
18:12 when falling off the hill and the last
18:14 step where all the magic will happen
18:17 will tweak some controller values first
18:20 I like to look at this line what it does
18:22 is that when the player stops holding
18:25 the right or left key the character
18:28 should gradually slow down function move
18:31 toward takes current velocity which at
18:34 maximum is currently 300 and brings it
18:38 slowly back to zero using steps the
18:40 problem is that by default the steps are
18:43 defined using the same variable as the
18:46 maximum speed that causes the instant
18:48 speed drop when the key is no longer
18:51 pressed I would suggest inputting
18:53 something smaller here for example value
18:57 10 that way we'll get this fun slowing
19:00 down effect what is great about gdo is
19:02 that you can tweak some variables
19:05 without stopping the game for example if
19:08 I would change that to four and save the
19:10 player will behave as it it's on the
19:15 eyes I think 12 is an optimal value now
19:17 how about the other values when you
19:19 scroll up you can see those three
19:22 variables speed which is a max speed
19:25 character can travel with jump velocity
19:28 and gravity let's start with the last
19:31 one its value is taken from the project
19:34 settings so go to project project
19:37 settings search for Gravity it will be
19:39 in the physics 2D and change it to
19:42 something bigger like
19:46 2500 I'll increase the speed to 400 and
19:49 the jump velocity to minus 900 remember
19:53 minus values are going upwards after all
19:55 of those changes press save start the
19:59 game and try it out in in my opinion
20:01 it's way better than what we started
20:04 with that was a long chapter so here is
20:08 a great reward scripting gold badge good
20:12 job time for the last Quick addition for
20:14 now we can only use arrows and space to
20:17 control our character but what if you'd
20:20 like to add other Keys when you check
20:21 out the script you can see that we
20:24 Define key presses using the UI accept
20:28 left and right this is not ideal those
20:30 mappings should be used only for the
20:33 user interface and in fact code commands
20:36 tell us exactly that we need to replace
20:39 them with manually defined actions go to
20:42 project project settings and select the
20:45 input map tab at the top here we can
20:48 declare actions and key mappings here
20:52 type left and press return I will also
20:55 add the same way right and jump under
20:57 each of the sections we'll Define all
21:00 keys that should trigger it click the
21:02 plus icon next to the left action and
21:05 press the left Arrow key it should
21:07 automatically find the key you are
21:10 looking for I will do it again for the a
21:14 key to enable A and D movement finally
21:15 if you'd like your game to support the
21:18 GamePad you can search for left stick
21:22 left and d-pad left I think that should
21:25 be it now pause the video and complete
21:27 this input map with all the remaining
21:29 key combinations for your
21:32 game all right here is my final
21:34 configuration to apply it in the code
21:37 all we need to do is to replace those UI
21:41 something strings with jump left and
21:44 right that's it that way you just
21:47 completed all the budgets for this video
21:49 congratulations if you liked this
21:51 tutorial subscribe to Coco code and
21:54 check my other videos as always big
21:56 thanks to my awesome patrons that
21:59 support this channel visit a link under