C# Godot Tutorial 1 - Creating a basic game

  Рет қаралды 141,569

Abdullah

Abdullah

Күн бұрын

Пікірлер: 296
@thedigitalwolf6932
@thedigitalwolf6932 2 жыл бұрын
finally someone acually explaining things instead of just showing and expecting us to understand
@brohenverhoeven4487
@brohenverhoeven4487 Жыл бұрын
Just wanted to make a quick comment about the KeyList error some people may have. The newest version of Godot has changed it to Key. So be careful when following along in the future. Still an amazing tutorial so far.
@Abdullah-mg5zl
@Abdullah-mg5zl Жыл бұрын
Thanks for the update!! Appreciate it
@monkeygenerator6394
@monkeygenerator6394 Жыл бұрын
Thanks mate, was having that issue.
@lionsinescanor8846
@lionsinescanor8846 Жыл бұрын
thank you I had the same issue helped me a lot
@red5467
@red5467 Жыл бұрын
Can you please provide the revised code? I'm still having issues even after changing keylist to key
@karola.7908
@karola.7908 11 ай бұрын
@@red5467 Works for me if you remove the casting to int if (Input.IsKeyPressed(Key.W)) { this.Position += new Vector2(0, -dist); } Just change "dist" to your distance moved variable
@yt.devhitoriii
@yt.devhitoriii Жыл бұрын
As a Unity game developer that trying Godot for the first time, thank you for this awesome channel.
@Abdullah-mg5zl
@Abdullah-mg5zl Жыл бұрын
You're very welcome, always glad to help
@PeskySpyCrab
@PeskySpyCrab 4 жыл бұрын
Quick tip, in Editor Settings under Mono and editor you can set Visual Studio Code as the default for scripts
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Thanks for this!
@junaidkhanmomin7955
@junaidkhanmomin7955 2 жыл бұрын
This should be pinned.
@blahthebiste7924
@blahthebiste7924 Жыл бұрын
What does this actually do?
@OathOblivio
@OathOblivio Жыл бұрын
@@blahthebiste7924 This allows you to open new and existing scripts in VS code (if that is your preferred IDE) automatically/directly instead of opening code in the script window in the Godot editor (the Godot Editor is pretty much a bare-bones notepad with colored text. It has no context based suggestions or any syntax analysis. It is utter garbage). Nevertheless, it's an excellent quality-of-life improvement and saves time (the few seconds it takes to switch from one window to the next manually adds up to hours of wasted time over extended working periods, which is why it's a significant improvement).
@ryuu7644
@ryuu7644 Жыл бұрын
It was updated- (top left corner) Editor -> Editor Settings -> Text Editor -> External. Then check the Use external editor box and specify the path.
@karlstenator
@karlstenator 2 жыл бұрын
Such a great tutorial, exactly what I was needing to know. VS Code is awesome, and so excited to find that Godot supports C#
@Maite-AileenBrandt
@Maite-AileenBrandt Ай бұрын
Wow, thank you so much for that overview! - Exactly what I needed (since I already worked with Unity, so the basic workflows of Godot do interest me more than the specifics at this point, really :) ).
@tehufn
@tehufn Жыл бұрын
Clear, straightforward, and we get something interesting happening really fast. Thanks!
@bodamat
@bodamat 4 жыл бұрын
Excellent tutorial! I wanted to use Godot with C# and your tutorial is helping! Thanks!
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Not a problem! Super glad you find the tutorials helpful!
@daboxguy3848
@daboxguy3848 2 жыл бұрын
Coming from Unity to Godot made this a lot easier. Pretty simple really 👌
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
Awesome! Glad to help!
@zorq2
@zorq2 4 жыл бұрын
This was a great video. It inspired me to install Godot with Mono on my Windows machine and try your tutorial. I did have one big problem though. Your tutorial worked for every step until I added the script to the sprite node. After that step every time I tried to press play I would get an error message. I did find a solution apparently for windows installations it is important to install some additional libraries and resources: NET Core SDK .NET Framework 4.7 Targeting Pack .NET Core Runtime Also if you install the VS Code the following settings are helpful Editor -> Editor Settings General -> Mono -> Builds -> Build Tool: MSBuild (VS Build Tools) if on Windows or MSBuild (Mono) for other platforms. General -> Mono -> Editor -> External Editor: Visual Studio Code After that it was working great.
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Hey ! Thanks for the detailed resolution! I'm using it on windows as well, didn't have any issues, but I have SO many frameworks installed on my machine that I might have already had it's requirements.
@brucelee7782
@brucelee7782 Жыл бұрын
THank you for this, im switching from unity to c# after that horrible unity fee news and I already sank time into learning c#
@bready2die349
@bready2die349 6 ай бұрын
Hi! I know I'm quite late to the party xD but I was wondering why did you do a casting in min 10:07 at line 15 if( Input.IsKeyPressed( (int) KeyList.W ) )
@hatersgonnalovethis
@hatersgonnalovethis 3 ай бұрын
Has to be if (Input.IsKeyPressed(Godot.Key.W))
@NK01187
@NK01187 3 жыл бұрын
Great tutorial, thanks a lot. I was looking for a game engine that works on Linux where I can script in C#. Your tutorials are very helpful.
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
No problem! Glad they are helping you!
@mycollegeshirt
@mycollegeshirt 3 жыл бұрын
the first 35 seconds are so true, I'm looking for a good tutorial for my girlfriend to learn programing, and game programming is absolutely the best way to do that, since it's fun challenging and has a lot more depth than you need in industry. Godot is a great choice, but so many people teach a beginner program a very specific language for one place, for a seasoned programmer it doesn't matter, but for a new programmer that's a bit cruel.
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Exactly! I understand that GDScript is made to be very convenient for godot, but I just don't wanna learn/practice a language that will only ever be useful for godot.
@kylesookram6518
@kylesookram6518 3 жыл бұрын
Thanks, I looked all over I couldn't find a Godot c# tutorial Im so glad I found this.
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Yeah, not much Godot C# content out there, glad these helped you!
@ojisan4220
@ojisan4220 8 күн бұрын
Looks like this playlist should be fully updated. Anyway, thank you for your work!
@Peter-vx5yf
@Peter-vx5yf 4 жыл бұрын
thank you, really, i'm from Brazil and don't have much tutorials about Godot in portuguese, and i see a lot of english tutorials and only this make me understand. relly nice work. sorry the worse english i'm still learning :/
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Thank you! Your English is good! Much better than my portuguese 😋. I was able to understand you perfectly. Glad you like the tutorials, I try to use simple words and sentences, not just for non English speakers but because it makes learning easier for everyone. No need to use complex when simple works !
@Peter-vx5yf
@Peter-vx5yf 4 жыл бұрын
@@Abdullah-mg5zl your welcome :)
@navalhabr
@navalhabr Жыл бұрын
Godot 4.1+ if(Input.IsActionPressed("ui_up")) { this.Position += new Vector2 (0, -AMOUNT); } - ui_up, ui_down, ui_left, ui_right [And use Key Arrows to move around] - Later you'll learn how to map other keys (like W, S, A D) in the Project / Project Settings / Input Map (tab) - You can go there to see (or Edit) other Built-in keys (labels) (Toogle on: Show Built-in Actions) or add your own.
@navalhabr
@navalhabr Жыл бұрын
@@HiddenRealm Idk, i'm a newbie. This is the example in the oficial Godot Page (Getting started).
@MerijnCappelle
@MerijnCappelle Жыл бұрын
Hey, its not working i did how you said and it does not work@@HiddenRealm
@ArseneAnalysis
@ArseneAnalysis 11 ай бұрын
Looking for this comment, thanks!
@weapons_seven
@weapons_seven 4 ай бұрын
Thank you
@RokeJulianLockhart.s13ouq
@RokeJulianLockhart.s13ouq 2 ай бұрын
Thank you. This fixed CS1955.
@MarioDiCoCo
@MarioDiCoCo Жыл бұрын
Damn, this tutorial is super clever and good for beginners as I do. Thanks bud for it.
@kinoko87_b
@kinoko87_b 3 жыл бұрын
Thanks, as a C# dev this is really helpful :)
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Not a problem
@focusthenflex
@focusthenflex 2 ай бұрын
Great series so far!
@fatemeetsluck
@fatemeetsluck 3 жыл бұрын
Nice I love C# and I downloaded the Mono Godot version on purpose.
@cleanwalrus
@cleanwalrus Жыл бұрын
Thanks for the tutorial, stuff like this will probably blow up after Unity messed up big time.
@kelcapiral5301
@kelcapiral5301 Жыл бұрын
Thank you! Tutorial is very easy to understand. You deserve my sub
@fonknight5625
@fonknight5625 Жыл бұрын
There's something about your voice that makes me calm
@lichen420
@lichen420 4 жыл бұрын
I love the tutorials. For this tutorial I had to change the .csproj file that was generated to point to .NET framework 4.5. The file generated a pointer to .NET 4.7 but mine was 4.8. When I pointed it to 4.8 it said it wanted 4.5. So I pointed it to 4.5 and it worked.
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Ah, that's good to know, I'm sure more people will be having this issue so thanks for posting. Have a great weekend!
@bmigamedev1741
@bmigamedev1741 2 жыл бұрын
how you pointed the targeted .net ? i got error on my godot 3.5.1 mono when i run tutorial above. :(
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
Open the .csproj file with a text editor and look for something like 3.1, the value in between the xml tags is the target frame work version, change it and then save the file :)
@playerknownwell3702
@playerknownwell3702 3 жыл бұрын
This is great! I appreciate the effort but sadly I am quite the absolute beginner and didnt quite understand all of this but I will check out other tutorials!
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Yup, that would be the right thing to do!
@Catherine_Ea
@Catherine_Ea Жыл бұрын
thank you, I am a student and trying to be a hireable programmer and learning c++ and c# sounds a good pick, and I like open source software but most tutorials use GDScript and that won't do for me
@arnavbansal348
@arnavbansal348 3 жыл бұрын
um I have a question I am running the code but it is saying failed to build project error how can I fix this?
@van3ll0pe
@van3ll0pe Жыл бұрын
Awesome !! Hope you're there to teach godot. I already know c#, but not godot. thank you so much !
@kmalnasef1512
@kmalnasef1512 Жыл бұрын
Thank you for this good set of tutorials. God bless you bro.
@brianbathory4943
@brianbathory4943 4 жыл бұрын
Great stuff, thanks a lot... I was having a lot of issues getting it to work with other tutorials
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Not a problem! I see that you're watching both this and my top down shooter series. In case you were wondering what the differences were: This series covers godot topic by topic (well, the most "important/commonly used" topics anyways) while the top down shooter series is focused on a specific example of building a top down shooter, and explains topics as they are encountered along the way. Also, the top down shooter series is more beginner friendly. The two series are complementary, but if you are not a beginner you may have to "skim" the top down shooter videos, especially the parts that explain really basic things (like game loops).
@brianbathory4943
@brianbathory4943 4 жыл бұрын
@@Abdullah-mg5zl Yeah I'm actually gonna sit through this series as fast as possible just to understand godot a bit better. It's my first game engine after all. I've only used frameworks before and just with c++ so I have to get familiar with c# as well. That's why I'm enjoying your videos a lot, they feel very well explained
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
@@brianbathory4943 Sounds like a good plan! Glad the videos are useful to ya! One note: You may have to look up some C# syntax here and there as I don't really explain C# in these videos, I just explain Godot. However, coming from a C++ background, C# will be very easy for you to pick up, and you will enjoy it more. C++ is also where I came from.
@brianbathory4943
@brianbathory4943 4 жыл бұрын
Yeah I'm really excited to follow along
@jetskinotcommit
@jetskinotcommit Жыл бұрын
hi abdullah, can you link the tutorial for setting up vscode with c# and godot? i cant seem to find it
@robwalker4653
@robwalker4653 10 ай бұрын
should always use the delta in your vector math for movement, this way you're movement should be consistent and not tied to frame rate.
@yahyaayman5894
@yahyaayman5894 3 жыл бұрын
عاش يا معلم keep on good content ❤️
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Thank you very much!
@XANDERJAREDKENTOGAYON
@XANDERJAREDKENTOGAYON Жыл бұрын
Can i ask what extensions you use for vscode for coding c# in godot?
@MrCorruptex
@MrCorruptex 3 жыл бұрын
Had a couple issues. Need to make sure you have the dotnet framework 7.2 from 2018 for godot 3.2. and build wouldn't work until you enter an actual value where he puts in AMOUNT.
@Mob-un6ei
@Mob-un6ei 3 жыл бұрын
I LOVE YOU THANKS BRO THE TUTORIAL WAS VERY NICE AND I WAS ABLE TO UNDERSTAND IT VERY WELL
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
lol no problem man, glad it helped ya out!
@mahersabit9265
@mahersabit9265 Жыл бұрын
gave me a bunch of errors like KeyList doesnt exist and Vector2 cant be used as a method. So, i removed the (int) and the KeyList and that seemed to work for the input, but the Vector part still dont work
@Rawbherb
@Rawbherb Жыл бұрын
if (Input.IsKeyPressed((int)KeyList.W)) doesn't work anymore in the latest version of Godot, I think it's if (Input.IsKeyPressed(Key.W)) ?
@RednekGamurz
@RednekGamurz Жыл бұрын
Can confirm.
@CosTheVampire
@CosTheVampire Жыл бұрын
for those doing everything right with the error Failed to build project solution, make sure that the file isnt in a directory with a character like #
@geomorillo
@geomorillo 3 жыл бұрын
Great i love c# and godot thanks i was stuck on some issues with C#
@tobitoon3171
@tobitoon3171 8 ай бұрын
What extensions I need for VSCode? I do not get these predictions like "isKeyPressed"and for example "Vector2" is not turning green.
@eggstacy4178
@eggstacy4178 8 ай бұрын
Good question - I have the godot-csharp-visualstudio installed in Visual Studio Community, which is supposed to be the extension for Godot support, but it doesn't seem to be working for me. Not getting the predictions either.
@rippers88
@rippers88 2 жыл бұрын
Thank you so much for making a decent tutorial!
@Abdullah-mg5zl
@Abdullah-mg5zl Жыл бұрын
Haha not a problem! Thanks for watching and have a great new year!
@mdrow100
@mdrow100 23 күн бұрын
Correct code for the Sprite2d.cs using Godot; public partial class Sprite2d : Sprite2D { // Called when the node enters the scene tree for the first time. public override void _Ready() { } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { float AMOUNT = 5; if (Input.IsKeyPressed(Key.W)){ this.Position += new Vector2(0, -AMOUNT); } if (Input.IsKeyPressed(Key.S)) { this.Position += new Vector2(0, AMOUNT); } if (Input.IsKeyPressed(Key.A)) { this.Position += new Vector2(-AMOUNT,0); } if (Input.IsKeyPressed(Key.D)) { this.Position += new Vector2(AMOUNT,0); } } } Also when you name the Sprite and use a lowercase d it will suggest you capitalize but you can ignore it.
@cloudburp8485
@cloudburp8485 11 ай бұрын
the key list isn't working for me? what is says is "The name 'KeyList' does not exist in the current context" can someone help me?
@hokageofthecloud3889
@hokageofthecloud3889 7 ай бұрын
"if (Input.IsKeyPressed((int)KeyList.W))" doesn't work anymore in the latest version of Godot, I think it's "if (Input.IsKeyPressed(Key.W))" ? Credit to: @Rawbherb
@LaKabaneProduction
@LaKabaneProduction 7 ай бұрын
Replace by this ! Look at the Comments of @navalhabr ! if(Input.IsActionPressed("ui_up")) { this.Position += new Vector2 (0, -AMOUNT); }
@nodvick
@nodvick Жыл бұрын
any reason you don't do something like: float velY = 0; float velX = 0; if (keyPressed(Key.W)) velY -= Velocity; if (keyPressed(Key.A)) velX -= Velocity; if (keyPressed(Key.S)) velY += Velocity; if (keyPressed(Key.D)) velX += Velocity; this.Position += new Vector2(velX,velY); I really think it looks better that way
@memegod5207
@memegod5207 2 жыл бұрын
Thank you so much for this tutorial. You helped me out a TON.
@Abdullah-mg5zl
@Abdullah-mg5zl Жыл бұрын
You're very welcome! Have a wonderful new year!
@parvatiprabhu56
@parvatiprabhu56 4 жыл бұрын
Wow I wanted to use Godot with C# thanks very much
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
No problem!
@ward3n1
@ward3n1 3 жыл бұрын
before you leave go to Project > Tools > C# > Generate C# Solution this will make your code run next time you load up the project
@laknathdias5235
@laknathdias5235 11 ай бұрын
Unfortunately I think the C# library's for Godot has changed quite a bit since this tutorial. So the code is no longer valid
@logofios
@logofios 5 жыл бұрын
Godot is a pretty engine
@Abdullah-mg5zl
@Abdullah-mg5zl 5 жыл бұрын
Yeah, it's very easy and fun to use!
@BananaDope
@BananaDope 2 ай бұрын
What Formatting do you use?
@alperenylm.0
@alperenylm.0 8 ай бұрын
Hello Bro! I will ask a question. Why did you use int before Keylist?
@PaulJonesy
@PaulJonesy Ай бұрын
Because the value in keylist is an Enum, not an int.
@ianisgamingxd7119
@ianisgamingxd7119 10 ай бұрын
Um, I get the error "cannot convert from 'int' to 'Godot.Key'. Can anyone help
@Seno_was_taken
@Seno_was_taken 5 ай бұрын
It doesn't give choice for C# only gdscript
@se__achraf
@se__achraf Жыл бұрын
Do I need to learn C# before starting this course?
@swiftypopty1102
@swiftypopty1102 9 ай бұрын
It is possible to learn C# from scratch when using Godot but things will be easier & much better if you did have previous experience(e.x Unity) with C# as of right now, the C# support is great & wonderful but the documentation? It's lacking in that aspect. If you look at Unity, the documentation & community is massive for C#, you definitely can learn C# without any experience with Unity because many docs & tutorials existed on the internet mostly covering every kind of issue & features that come with Unity.
@TheLolPoster
@TheLolPoster 2 жыл бұрын
My sprite zooms off screen instantly upon a key press, exact same code, not sure the issue here.
@kostakis98
@kostakis98 3 жыл бұрын
Nice tutorial !!
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Thank you!
@AndersonOliveiraDev
@AndersonOliveiraDev 5 жыл бұрын
Great tutorial.
@Abdullah-mg5zl
@Abdullah-mg5zl 5 жыл бұрын
Thanks!
@ahmednaffa700
@ahmednaffa700 3 жыл бұрын
i think that's more clean why to make the player move public int speed ; var motion = new Vector2(); motion.y = Input.GetActionStrength("down") - Input.GetActionStrength("up"); motion.x = Input.GetActionStrength("right") - Input.GetActionStrength("left"); MoveAndCollide(motion.Normalized() * speed * delta); but you have to config the editor input settings what do you think about it ?? and thanks for the tutorial
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
If by "cleaner" you mean more general because you are not tied to specific keys, then yes. And no problem
@moved159
@moved159 3 жыл бұрын
yeah definitely better, although, a simple controller is better to show off how to get started.
@tz2184
@tz2184 3 жыл бұрын
Nice tutorial. Thanks
@Hazelhana102
@Hazelhana102 3 жыл бұрын
BRO!!! Thank you for making this video
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
You're very welcome!
@iceblocksoda8214
@iceblocksoda8214 2 жыл бұрын
You are amazing Mr
@Abdullah-mg5zl
@Abdullah-mg5zl Жыл бұрын
Thank you! Happy new years!
@verminplayz2798
@verminplayz2798 2 жыл бұрын
Hello If I may ask, why is there no intellisense, I tried a lot of debugging but it still doesnt work
@hana7334
@hana7334 21 сағат бұрын
So (int)KeyList didn't work/exist for me. May be outdated after 5 years? Instead I used: public override void _Process(double delta) { float AMOUNT = 5; if (Input.IsKeyPressed(Key.W)){ this.Position += new Vector2(0, -AMOUNT); } else if (Input.IsKeyPressed(Key.A)){ this.Position += new Vector2(-AMOUNT, 0); } else if (Input.IsKeyPressed(Key.D)){ this.Position += new Vector2(AMOUNT, 0); } else if (Input.IsKeyPressed(Key.S)){ this.Position += new Vector2(0, AMOUNT); } } Thanks a lot for the Turorial btw!! Appreciate it.
@teawacrossman-nixom7696
@teawacrossman-nixom7696 3 жыл бұрын
Thanks man, your a Legend
@fatemeetsluck
@fatemeetsluck 3 жыл бұрын
BTW to get VSCode with Omnisharp to parse the C# on Ubuntu 20.04 I had to change the Tutorial.csproj tag to say "net5.0" because I have dotnet 5 available for Linux installed but 4.7.2 is not available on Linux and I have no clue how to fix it with Mono. Somehow it still worked in Godot.
@fatemeetsluck
@fatemeetsluck 3 жыл бұрын
I think it might be because I didn't install the correct latest mono by updating repos but who knows.
@daboxguy3848
@daboxguy3848 2 жыл бұрын
There isn't a definition of position from this. I'm using 3d nodes, but I'm not sure if that makes a difference?
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
Yup it makes a difference! For 3d nodes (which inherit from Spatial), you do theNode.Transform.Origin to get the position. And for global position, do theNode.GlobalTransform.Origin
@paulo0651
@paulo0651 4 жыл бұрын
Thanks for this tutorial. I’ll save it in the watch-later list because it’s pretty late right know. xD Thanks!
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
You are very welcome! And that sounds good haha
@paulo0651
@paulo0651 4 жыл бұрын
@@Abdullah-mg5zl No problem. I'm watching right now. 😂
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
@@paulo0651 Haha, a man of your word I see! Hope you enjoy them!
@paulo0651
@paulo0651 4 жыл бұрын
@@Abdullah-mg5zl Hey, I've got a problem while building the project, it tells me "failed to build project solution". :(
@paulo0651
@paulo0651 4 жыл бұрын
@@Abdullah-mg5zl I don't know if you know how to solve it.
@hotdawg6748
@hotdawg6748 2 жыл бұрын
Why does mine say : Failed to build?
@woosix7735
@woosix7735 3 жыл бұрын
i just want C# for dat sweet static typing.
@JK92007
@JK92007 5 жыл бұрын
plz make more games using c#...
@Abdullah-mg5zl
@Abdullah-mg5zl 5 жыл бұрын
I definitely plan on doing that. Have a great weekend!
@runestamp89
@runestamp89 Жыл бұрын
Problem is, "KeyList" is n o longer working. But i dont know what workes instead now
@Tbroo232
@Tbroo232 3 жыл бұрын
wait at 8:29 he says to uncommit the code what does that mean and how do i do it
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Uncomment means to remove the two leading slashes from every line of code. VS code has a "toggle comment" command. You can open the command pallate by pressing Ctrl + Shift + P, then type "toggle comment", then select the command.
@jillytot1981
@jillytot1981 Жыл бұрын
Another key difference in picking a scripting language is that while faster iteration may be possible with GDScript due to it being an interpreted language that doesn't need to be compiled like C#, it could ultimately have less runtime performance for exactly this reason. Probably not an issue though for most games and projects.
@Mystical-TEDDY_
@Mystical-TEDDY_ 2 жыл бұрын
I've only used visual studio before and not Visual Code, and i'm really confused on the part where you say you format the document and now it's saying I have to install a formatter and idek what that is or does or which one I should get
@Mystical-TEDDY_
@Mystical-TEDDY_ 2 жыл бұрын
Okay I figured it out, and for anyone else that might be stuck, basically a formatter is just an add on you install to automatically make ur code prettier. Press Shift + Alt + F if you don't have one and it'll tell you, you need one and then just click install formatter. A search bar will pop up and in that type Prettier, cuz that one seems good. I installed the version 2.07 without knowing there's a version 9 one but this version 2 works fine
@Smilysis
@Smilysis 4 жыл бұрын
Hi! Is there any way to use "switch" and "case" instead of "if" for player moviment?
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Hello! No because we have to call `Input.IsKeyPressed()` for each key we are testing. Switch statements can be used when you have a single variable and you want to do different things based on the different values that the variable might be. Here, we call Input.IsKeyPressed() 4 different times (each with a different argument (i.e. different key)), so you can kinda think we have 4 variables (even though we are not storing them in a variable, we still have 4 expressions).
@haensl35
@haensl35 2 жыл бұрын
@@Abdullah-mg5zl I just checked, that you could use a Dictionary to store all your movements and walk through that dictionary to see, if that button was pressed. It's much more maintainance-friendly and also keeps your code clean. using Godot; using System; using System.Collections.Generic; public class Sprite : Godot.Sprite { private Dictionary dict; private float AMOUNT; public Sprite(){ this.AMOUNT = 5; this.dict = new Dictionary(); this.dict.Add(KeyList.W, new Vector2(0,-AMOUNT)); this.dict.Add(KeyList.S, new Vector2(0,AMOUNT)); this.dict.Add(KeyList.A, new Vector2(-AMOUNT,0)); this.dict.Add(KeyList.D, new Vector2(AMOUNT,0)); } // Called when the node enters the scene tree for the first time. public override void _Ready() { } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(float delta) { var it= dict.GetEnumerator(); while(it.MoveNext()){ if(Input.IsKeyPressed((int)it.Current.Key)){ this.Position += it.Current.Value; } } } }
@VaderNgoDev
@VaderNgoDev 2 жыл бұрын
very helpful for new guy like me
@iainbroomell559
@iainbroomell559 2 жыл бұрын
migrating over to godot (temporarily) from unity cause my friend wants to work on something together but he's making me do it in godot so thanks for this help.
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
You're very welcome! I think you will like Godot, it's much simpler than unity in my opinion, though more buggy!
@janne_gamez8766
@janne_gamez8766 2 жыл бұрын
Very helpful. I hope i can get good enough to create a small game myself cuz of school and stuff
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
You absolutely can! If this is your first fame, try to make it small/simple, and if you finish fast, you can always try to make a bigger one
@janne_gamez8766
@janne_gamez8766 2 жыл бұрын
@@Abdullah-mg5zl Yea i have something small with the good old Pokémon Gameboy grafics in mind
@brotherthegrest
@brotherthegrest Жыл бұрын
there is a problem for me it says KeyList dosent exist in the current context
@davidp5540
@davidp5540 Жыл бұрын
Godot 4 replaced it with Key
@techmiker
@techmiker 3 жыл бұрын
I got "Failed to build project solution". Trying to run in Fedora. I don't see any other errors. Any ideas?
@techmiker
@techmiker 3 жыл бұрын
Ignore that! I fixed it by installing mono-devel in case anyone else had the same problem!
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Thanks for sharing your solution!
@drearr3608
@drearr3608 2 жыл бұрын
I do have an issue, when I try to run it, it says "Fauled to build project solution" I get errors saying the name "KeyList does not exist in the current context"
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
Go to your settings, build, mono, what mono tool are you using to build?
@drearr3608
@drearr3608 2 жыл бұрын
@@Abdullah-mg5zl I cant find Build, Mono path in project settings. Is there another setting I should be looking at? I found something before but couldnt find it again, it was I think Mono, Builds
@drearr3608
@drearr3608 2 жыл бұрын
@@Abdullah-mg5zl I found a build tool in editor settings, It says dotnet CLI
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
@@drearr3608 does the file where you use KeyList have "using godot" at the top?
@drearr3608
@drearr3608 2 жыл бұрын
@@Abdullah-mg5zl Yes
@rkyougetwht7296
@rkyougetwht7296 4 жыл бұрын
I don't understand vs code part where u have to command
@rkyougetwht7296
@rkyougetwht7296 4 жыл бұрын
Can I plz have assistance
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Hello! You press "ctr+shift+p" to bring up the command pallate, where you can type in vs code specific commands. I have a tutorial on vs code here: kzbin.info/www/bejne/mGTddnZjhdCsrKM
@Unlife_First
@Unlife_First 9 ай бұрын
Тоже не нашел на ру-ютубе гайдов по C# в годоте?
@arcc0t
@arcc0t 2 ай бұрын
А мне этот ру ютуб нахуй не нужон
@madalitsomaunda7147
@madalitsomaunda7147 2 жыл бұрын
I keep on getting an error when I add a script "failed to build project solutions"
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
Do you have dot net installed?
@madalitsomaunda7147
@madalitsomaunda7147 2 жыл бұрын
@@Abdullah-mg5zl No
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
You need to install .net or mono in order to build c# godot projects
@TheRealMangoDev
@TheRealMangoDev 7 ай бұрын
btw pls make mobile joystick tutorial i wanna make a mobile game in godot
@carlsonraywithers3368
@carlsonraywithers3368 3 жыл бұрын
Just a little question, Does using c# instead of gdscript take a toll on the performance of the game or game engine?
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
Absolutely not! If anything, C# is faster.
@jameshood790
@jameshood790 3 жыл бұрын
C# is about 3 to 4 times faster than GDscript, from what I read.
@muheydari
@muheydari 7 ай бұрын
5 pixels???
@TheSliderW
@TheSliderW 4 жыл бұрын
Shouldn't constant declarations be in the _Ready section ?
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Not necessarily. If you only need to use a constant in a particular method, why not declare it in that method? I like to keep variables as local as possible.
@TheSliderW
@TheSliderW 4 жыл бұрын
@@Abdullah-mg5zl I was thinking that the main method being repeated each frame would imply the const declaration would also be initialised on each frame for no reason whereas it would only be initialised once in the ready. I'm not familiar enough with these languages to know if this would matter performance wise once compiled, especially in big projects. Maybe the compiler knows how to optimise this ?
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
"maybe the compiler knows how to optimize this?" - bingo! You are correct! The compiler is *very* good at optimizing little things like this. Write for *readability* first, worry about "micro" optimizations like this only once you have *proven* (via profiler) that it is hurting your performance. Now I'm not saying don't worry about performance at all, worry about it at the architectural and algorithmic level, and only worry about these micro optimizations once you've proven that they are hurting you.
@TheSliderW
@TheSliderW 4 жыл бұрын
@@Abdullah-mg5zl Yeah. I'm aware of these principles and you're right. It's just that small things like that tend to tingle my mind. Thanks
@datacoman7744
@datacoman7744 2 жыл бұрын
I don't know what is is I've done everything the exact same but it says there are 16 errors when i try to launch it in Godot please help I am very confused
@datacoman7744
@datacoman7744 2 жыл бұрын
this is future me I still couldn't get it to work but i went onto your files and realized I did mess up
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
Hello! Can you tell me your first error message?
@datacoman7744
@datacoman7744 2 жыл бұрын
@@Abdullah-mg5zl thanks for your concern but I've already fixed the issue
@rudrasingh-ie5on
@rudrasingh-ie5on 4 жыл бұрын
Hello, I did exactly what you did but for some reason, I can't get my player to move
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Hello! Well if you did *exactly* what I did, then your player *would* move, therefore you did *not* do exactly what I did! Compare your code with my code (posted in the description of the video).
@felixsnz7764
@felixsnz7764 5 жыл бұрын
when i add a cs script i got an error, then i try to play the scene and godot crashes without showing any message
@Abdullah-mg5zl
@Abdullah-mg5zl 5 жыл бұрын
I have noticed Godot randomly crashing on me a few times as well. I just save frequently. Hopefully they will iron out their bugs in the near future!
@mato-ub3xn
@mato-ub3xn 4 жыл бұрын
I don't know if this tutorial is already old or something but i'm getting error in Godot that says "Parser Error: Unexpected token: Idenifier:using" and don't know what to do with it
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Are you sure you downloaded the MONO (C#) version of godot?
@mato-ub3xn
@mato-ub3xn 4 жыл бұрын
@@Abdullah-mg5zl oh.. I actually didn't, can I download it now and install or do I have to uninstall the version I'm using right now?
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
You can have both versions at the same time. With Godot, there is no "installing", you just unzip, and the launch the executable. However, for the Mono (C#) version, you will have to first install mono. The instructions for installing mono varies based on your operating system. Read the section of this page for your operating system: www.mono-project.com/download/stable/. Note, if you downloaded the 64 bit version of godot, make sure you download the 64 bit version of mono. If you downloaded the 32 bit version of godot, make sure you download the 32 bit version of mono.
@mato-ub3xn
@mato-ub3xn 4 жыл бұрын
@@Abdullah-mg5zl thanks a lot for fast reply. I'll try it out and send message again if it's working.
@mato-ub3xn
@mato-ub3xn 4 жыл бұрын
@@Abdullah-mg5zl okay, everything seems fine, no errors yet. thanks again for your help.
@najitetsuro
@najitetsuro Жыл бұрын
Some little changes in godot 4.1 using Godot; using System; public partial class movement : Sprite2D { // Called when the node enters the scene tree for the first time. public override void _Ready() { } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { var Amount = 7; if (Input.IsActionPressed("down")){ this.Position += new Vector2 (0,Amount); } if (Input.IsActionPressed("up")){ this.Position += new Vector2 (0,-Amount); } if (Input.IsActionPressed("right")){ this.Position += new Vector2 (Amount,0); } if (Input.IsActionPressed("left")){ this.Position += new Vector2 (-Amount,0); } } } as you can see, instead of float i use Double delta, also i declare var instead of float. let me know if this works or has anynthing wron, in my acse it works.
@MerijnCappelle
@MerijnCappelle Жыл бұрын
i did it but i cant get it to work
@MerijnCappelle
@MerijnCappelle Жыл бұрын
i found it and it works but not with wasd
@lavafox8436
@lavafox8436 4 жыл бұрын
when i try to run the game, it stops at the 'building project solution' part and then fails with the error message editor/editor_node.cpp:5273 - An EditorPlugin build callback failed. what do i do?
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
Did you make sure to download the MONO version of Godot? (Not the regular version)
@lavafox8436
@lavafox8436 4 жыл бұрын
@@Abdullah-mg5zl yeah, turns out i had the wrong build enabled
@storminfection5775
@storminfection5775 4 жыл бұрын
@@Abdullah-mg5zl I am getting this same error on Godot mono 3.2.3. Are there any other causes?
@Abdullah-mg5zl
@Abdullah-mg5zl 4 жыл бұрын
@@lavafox8436 could you elaborate on what you did to fix this issue?
@lavafox8436
@lavafox8436 4 жыл бұрын
​@@storminfection5775 in the editor settings, scroll all they way down to 'build' or something(its at the very bottom), then click build type and select MSBuild
@momanpro1804
@momanpro1804 2 жыл бұрын
How To Add A Language C# For Godot
@cqrc3282
@cqrc3282 2 жыл бұрын
Can I code the game entirely in C# without using any GDscirpt ?
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
Yes! :)
@cqrc3282
@cqrc3282 2 жыл бұрын
@@Abdullah-mg5zl why you didn't continue the series?
@Abdullah-mg5zl
@Abdullah-mg5zl 2 жыл бұрын
@@cqrc3282 been a bit busy trying to learn random stuff lol, also have been learning a lot more godot, so I'll upload new videos in this series probably starting this week! Sorry for the long delay tho!!
@cqrc3282
@cqrc3282 2 жыл бұрын
@@Abdullah-mg5zl Thank you for the efforts you made in this lovely series.
@mingosutu
@mingosutu 3 жыл бұрын
Do you need to have c# installed on your computer?
@Abdullah-mg5zl
@Abdullah-mg5zl 3 жыл бұрын
You need the "dot net sdk" or "mono sdk"
@mingosutu
@mingosutu 3 жыл бұрын
@@Abdullah-mg5zl Jazak Allaahu khair. What if already c# on my computer can I link it to Godot?!
C# Godot Tutorial 2 - Nodes
19:36
Abdullah
Рет қаралды 40 М.
Using Godot + C# + Visual Studio Code
13:38
Gamefromscratch
Рет қаралды 99 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
Godot & C++ -- How, What and Why?
12:56
Gamefromscratch
Рет қаралды 117 М.
Why You Should NOT Use the Godot Engine
4:40
StayAtHomeDev
Рет қаралды 98 М.
Godot Scripts I add to Every Game
12:34
Aarimous
Рет қаралды 54 М.
How To PLAN your Game as a Solo Developer
16:26
Heartbeast
Рет қаралды 525 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН