Raycast Weapons in Godot - Make an FPS in Godot Part 2

  Рет қаралды 57,208

Code with Tom

Code with Tom

Күн бұрын

In this video I will show you how to create a Raycast Weapon system in Godot
Part 1: • FPS Character Controll...
Source Code for Part 1: github.com/codewithtom/godot-...
Source Code for this tutorial: github.com/codewithtom/godot-...
This video covers creating a raycast weapon system in our FPS game, as well as inheriting from the base weapon to allow you to make modifications for new weapons and weapon types. We also add some simple UI to display the current ammo count and reloading status.
In this series of FPS Godot tutorials I will teach you how to make your very own FPS in Godot. Subscribe to stay up to date!
Music By: LAKEY INSPIRED @ / lakeyinspired

Пікірлер: 241
@specialeddgames5668
@specialeddgames5668 4 жыл бұрын
Great Tutorials, the best ones I can find on KZbin.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you so much!
@sergeiorlov5096
@sergeiorlov5096 3 жыл бұрын
I know that I'm a bit late with my reply, but heck - it might help someone reading this in the future. I LOVE Tom's tutorials, but you must know that theres quite a lot of quality tutors beside Tom. My personal favourites: "Game Development Center" - aimed at Diablo style rpg's and networking "Garbaj" - Just like Tom, he's mainly into FPS 'Rungeon" - a fairly new channel, but damn that guy is a gem. THE best platformer tutorials I've seen so far! "Heartbeast" - zelda-like (or ratherHyper light Drifter- like) arpg tutorials, and much more! "KidsCanCode" - This guy is a Wikipedia of Godot. Quality stuff! And these guys are just my top pics- I'm sure there's even more quality content out there. Hope that these references will help someone, as these tutors (Including Tom, obviously) helped me )
@anotherrandominternetguy404
@anotherrandominternetguy404 2 жыл бұрын
@@sergeiorlov5096 u r talking only about godot?
@alishehryar4099
@alishehryar4099 2 жыл бұрын
@@sergeiorlov5096 for us hes the best so stfu
@321357w
@321357w 4 жыл бұрын
Definitely hooked on these tutorials.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks Jeff that means a lot
@Kura.tf2
@Kura.tf2 3 жыл бұрын
(always make sure you check your CAPS while spelling RayCast in GDscript so you don't get a Null_Instance on null instance error)
@wasyouamv7773
@wasyouamv7773 2 жыл бұрын
Hello someone could help me every time I pull its me but the error code 'raycast.is_colliding () null instence so here is my script tell me the error that I made please extends Node class_name Weapon export var fire_rate = 0.5 export var clip_size = 5 export var reload_rate = 1 onready var raycast = $"../Head/Camera/RayCast" var current_ammo = clip_size var can_fire = true var reloading = false func _process(delta): if Input.is_action_just_pressed("primary_fire") and can_fire: # fire the weapon if current_ammo > 0 and not reloading: print ("Fired weapon") can_fire = false current_ammo -= 1 check_collision() yield(get_tree().create_timer(fire_rate), "timeout") can_fire = true elif not reloading: print("reloading") reloading = true yield(get_tree().create_timer(reload_rate), "timeout") current_ammo = clip_size reloading = false print ("reload complete") func check_collision(): if raycast.is_colliding(): var collider = raycast.get_collider() if collider.is_in_group("Enemies"): collider.queue_free() print("Killed" + collider.name)
@wasyouamv7773
@wasyouamv7773 2 жыл бұрын
not understand how to check her?
@Theinvalidmusic
@Theinvalidmusic 4 жыл бұрын
Adding to the chorus here that these are great tutorials you're doing. Really looking forward to more!
@DuranMetalWolf
@DuranMetalWolf 3 жыл бұрын
Amazing tutorial, your content is simply great! I have been messing arroung with Godot and you have helped me a lot to work my way out. Thanks for the great videos!
@KyleHarmieson
@KyleHarmieson 4 жыл бұрын
The class/inheritance solution to multiple weapons has totally revolutionised the way I design weapons in my game. Thank you so, so much for explaining how to define and inherit classes! I've even gone a step further and inherited from weapon to create three specialised classes: raycast_weapon, projectile_weapon and melee_weapon!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Glad I could help! That sounds like a perfect solution to varying weapon types.😁
@KyleHarmieson
@KyleHarmieson 4 жыл бұрын
@@CodeWithTom It's working beautifully! It also makes it much easier to organise the weapons in my project, and to refer to them and use their stats in the game. This "template" approach is perfect for my game's modular weapon system. Thanks again for the idea! :D
@Kura.tf2
@Kura.tf2 3 жыл бұрын
best free tutorials on youtube for sure
@CodeWithTom
@CodeWithTom 3 жыл бұрын
Thank you! :D
@anintruder2586
@anintruder2586 4 жыл бұрын
I honestly can't believe you only got 2k subs! You deserve more for your hard work and quality tutorials!!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you so much!
@frankoesavage8314
@frankoesavage8314 4 жыл бұрын
Thanks Tom, for making such a detailed explained video , your helping us all understand alot better.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome Frankoe
@the_dogey
@the_dogey 3 жыл бұрын
Really amazing tutorial. This videos are so good to learn GDScript for those who already know a different language already.
@devdurros3676
@devdurros3676 3 жыл бұрын
Thank you so much for these tutorials, really helping me with my 3D Godot game dev! Great tutorials
@dxrkst8623
@dxrkst8623 3 жыл бұрын
You have the most helpful channel for Godot. Thanks man.
@lumenwrites
@lumenwrites 4 жыл бұрын
Absolutely amazing tutorial! Please make more!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Ray that means a lot!
@lucavlase6993
@lucavlase6993 2 жыл бұрын
Tom, how do you only have 0.1% of the subscribers you deserve? The video quality is great, and your content is helping me a lot rn
@titustech7219
@titustech7219 2 жыл бұрын
combining this with the amazing garbaj weapon switching tutorial thank you soo much
@NeZversSounds
@NeZversSounds 5 жыл бұрын
Thank you for the awesome tutorials!
@CodeWithTom
@CodeWithTom 5 жыл бұрын
Thank you for watching! 😁
@zacharyschiffner2859
@zacharyschiffner2859 4 жыл бұрын
You're a great teacher I can't believe you only have 501 subscribers
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Zachary I really appreciate that!
@justasydefix6251
@justasydefix6251 3 жыл бұрын
it is now almost x15 :D
@starfrog1
@starfrog1 4 жыл бұрын
Many thanks! Much better than expected! Very well explained. :)
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks I appreciate the feedback 😊
@user-qx8re2em1b
@user-qx8re2em1b 4 жыл бұрын
Great tutorials, subscribed!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you!
@AleksandarPopovic
@AleksandarPopovic 4 жыл бұрын
Great tutorial, pls continue to work i love you work!!!!!and good luck for your work......
@user-wy7oh6tg1e
@user-wy7oh6tg1e 4 жыл бұрын
Best godot tutorial on KZbin
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Wow thank you for the kind words. :)
@pascalcasier959
@pascalcasier959 4 жыл бұрын
Thank you so much. Would love to see a tutorial on how to code arrows with gravity.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks for the suggestion 👍
@juliandavidgarciagonzalez3209
@juliandavidgarciagonzalez3209 3 жыл бұрын
it's great! these videos help me a lot!this is very interesting👍🏻
@holomode1357
@holomode1357 3 жыл бұрын
best godot tutorials in the whole internet
@fernandogramirez1
@fernandogramirez1 2 жыл бұрын
Thanks, excellent tutorial! Done!
@davidheadley8589
@davidheadley8589 3 жыл бұрын
Amazing series thank you
@bkaunghtet8425
@bkaunghtet8425 4 жыл бұрын
Thank You for this tutorial sir.
@ash.n51
@ash.n51 4 жыл бұрын
Go to 1:34 if you already watched part 1 :)
@iamelite20
@iamelite20 3 жыл бұрын
bro u are a legend i subscribed right awat
@victr3d
@victr3d 3 жыл бұрын
Great video! By the way, what computer do you have?
@aharonxxl2564
@aharonxxl2564 3 жыл бұрын
Thank you so much, you are a very good teacher.
@kornflakes8983
@kornflakes8983 2 жыл бұрын
Dude, this was the best fucking tutorial ever for raycasting. Thank you so much dude!
@azuolas5673
@azuolas5673 4 жыл бұрын
Great Tutorials THX
@gregorioespindola7171
@gregorioespindola7171 4 жыл бұрын
que bueno el mejor que vi 3d asta a hora muchas gracias!!
@KellenChase
@KellenChase 4 жыл бұрын
wow, so appreciated. this is a great tutorial series. learning a lot, and excited to have a character that can already run around and kill enemies. thank you! got a question that I will try and research if I don't see it covered. Ill edit this comment when I find an answer... when my mouse is not in the screen area when starting, any click, clicks me out of the game again as if Id hit the escape key. is there a way to grab the mouse cursor, center it, then run the capture process? it's not an issue if I hit play and then get my mouse into the window area before it's fully loaded. oooh... you pulled a sneaky around 13:50 ... added the class_name without telling us. when we create shotgun.gd, gives a little error when trying to extend without the class_name in Weapon.gd ... dangit... should have just played another 5 seconds of the video... ;) alright, so I added the ready process that was put in shotgun.gd to the ready process in weapon.gd (so the shotgun can inherit the generic fire_range, and that can be brought into all future weapons as well). I feel like one change that I am going to work on as well is that the reload should be able to happen right after the last shot... at current, it is waiting for a timeout to allow another shot, and then that shot turns into a reload... really enjoying this. thanks again! What I would like to see next... (don't know if its in the playlist from where I am sitting now) is an inventory system, weapon selection, etc.... I like the idea of an FPS RPG, and I think that those two combinations for a game covers so many concepts and ideas of game design, that it could be a great teaching series in itself.
@thomaseubank1503
@thomaseubank1503 3 жыл бұрын
Thanks for the tutorial
@innocentcat2
@innocentcat2 2 жыл бұрын
Yes a great tutorials
@bca_Amandeep_Singh
@bca_Amandeep_Singh 4 жыл бұрын
The " is_colliding()" and "get_collider()" are not working i've been searching the web and can't find the replacement. Please let me know the solution.
@anarchy3508
@anarchy3508 3 жыл бұрын
@@dominicuss please help me, i copied the code directly but there is NOTHING about the the enemy dissapearing and the raycast wont collide
@ryanmanville6883
@ryanmanville6883 4 жыл бұрын
thanks for the help!
@nuki_yt
@nuki_yt 4 жыл бұрын
Thank you dude. I expect great things from you. :) Google Translate...
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome! Thank you!
@flatboi5116
@flatboi5116 4 жыл бұрын
Gained my sub... amazing trutorials
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you very much
@Wasa-qo7vn
@Wasa-qo7vn 2 жыл бұрын
Thanks for base script!!! I will credit you in my indev game called Simulaning! ❤❤❤
@krasnavin
@krasnavin 2 жыл бұрын
Tom I always depend on your instructions. For next step how do I show my laser bullet firing? Thanks,
@Painple
@Painple 2 жыл бұрын
Nice video.
@user-tt6po2bd9m
@user-tt6po2bd9m 4 жыл бұрын
Great video! Could you tell me how to show the bullet moving?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks! Projectile bullets are definitely on my todo list.
@specialeddgames5668
@specialeddgames5668 4 жыл бұрын
Could you show us in the next video how to make it to where we can see where the bullet goes and have it shoot out of a gun
@CodeWithTom
@CodeWithTom 4 жыл бұрын
I'll add it to the list for sure. I'd like to add a decal system at some point for bullet holes etc
@retrocademedia-announcements
@retrocademedia-announcements 4 жыл бұрын
At 25:04 you can just use onready before current_ammo rather than using the ready function
@Buli0n
@Buli0n 4 жыл бұрын
Please show us how to make enviromental hazards such as water or lava or fire or smoke or fog, scripts of things that appear and dissapear and physics of ropes! 🙏
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Great suggestion! I'll add it to the list
@LockStockNBarrel
@LockStockNBarrel 4 жыл бұрын
Is yield() a non blocking wait? What happens to other code in the same function during that time? Does it actually block further code execution but only for the _process() function which runs on every frame? What if I want to do other things in the _process() function in the mean time?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Good question. Yields are complicated to explain in a single response. But they are effectively a way of initiating coroutines, freezing the current state of execution and resuming once they receive a completed signal. You can read more here: docs.godotengine.org/en/3.0/getting_started/scripting/gdscript/gdscript_basics.html#coroutines-with-yield
@Alternalo
@Alternalo 4 жыл бұрын
How can i make a visual feedback on the point of impact?
@JacobKinsley
@JacobKinsley 2 жыл бұрын
Is it better to create a raycast in code or to create a raycasts object in the scene and just hiding/unhiding? I'm assuming in the scene because then you don't have to create and delete it every time, but it only works if it's always from the center of the camera to the middle of the screen
@matrixchronic8542
@matrixchronic8542 4 жыл бұрын
Is there a way to show the Bullets coming out the gun
@geckopg3d394
@geckopg3d394 2 жыл бұрын
For those of you who want to reload when your ammo is at 0, simply put: if current_ammo < 1 and not reloading: reload() in the func _process(delta) function so you don't have to press r or shoot
@RexieRacer
@RexieRacer 10 ай бұрын
For anyone wondering, at the time im at in the video you dont need the export infront of the var (var fire_rate etc.) it made my code not work so i wanted to put this out so you know the problem.
@alialramadhan4748
@alialramadhan4748 4 жыл бұрын
hello mister Tom i hope you are having a great day, I appreciate your tutorial. I need help with something though if I want to have no reload weapon can i just skip the steps of 8:00 - 12:00 min mark?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hi Ali, absolutely! If you don't want reloading feel free to skip that entirely.
@alialramadhan4748
@alialramadhan4748 4 жыл бұрын
@@CodeWithTom thnks for the reply
@jackv7614
@jackv7614 3 жыл бұрын
how would you switch between two different weapons? when I try to change the script while it's running it crashes
@hobbesthebrainslug12
@hobbesthebrainslug12 2 жыл бұрын
Well here I am running into another problem. I'm at the point where we're coding the raycast to delete/kill enemies. I have everything set up as you put it. But nothing happens when I 'fire' on an enemy. It just prints 'fired weapon'. The enemy doesn't disappear. With 'Visible collision shapes' turned on I can see that the game knows something is there when I mouse over it. But wont do anything when I fire.
@MrTobbeman22
@MrTobbeman22 2 жыл бұрын
Sounds like you missed "collider.queue_free()"
@Jaydenbb5
@Jaydenbb5 4 жыл бұрын
for some reason my camera isn't working and I'm stuck on a grey screen instead of the camera that was working in ep 1
@rishianands8472
@rishianands8472 4 жыл бұрын
Thanks a lot TOM...
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome Rishi!
@vickylance
@vickylance 4 жыл бұрын
@26:16 I think the solution to directly access the label and change it every process frame is not a good practise in terms of both performance and single responsibility principle. The weapon class should not handle the UI elements. Instead what I think is that it should simply emit a signal and then the UI node should have a script that should capture that signal and then act upon it
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Very good recommendation, you're absolutely right. I will cover signals in a future video.
@sage1582
@sage1582 4 жыл бұрын
Nice vid
@andypandy-py1zc
@andypandy-py1zc Жыл бұрын
Great tutorial I look forward to completing the whole series. I am having trouble with the function check_collision(): My Godot_v3.5.1 throws an error "Attempt to call function 'is_colliding' in base 'nul instance' on a null instance." Does anyone know to fix this. I have tried prefixing raycast with a $ sign without success. would like to move on cause the tutorials are great & easy to understand, big thanks to Tom for making the video's.
@maricelugsod4770
@maricelugsod4770 3 жыл бұрын
11 out if 10 Tutorial
@RaiderJake
@RaiderJake 4 жыл бұрын
How would I set it to an automatic fire, like just holding the left click button? Great tutorials thank you.
@Dogman_35
@Dogman_35 4 жыл бұрын
Remove the "just" is is_action_just_pressed. The "just" means it only checks the first time you click, and if you remove it then it will constantly fire every time the firerate timer is up as long as you're holding down the button.
@RaiderJake
@RaiderJake 4 жыл бұрын
@@Dogman_35 awesome thx
@gamerukn4231
@gamerukn4231 2 жыл бұрын
Can you make a tutorial on wall running and vaulting for a 3d parkour game
@presleyknox9884
@presleyknox9884 3 жыл бұрын
how many videos are there in this series
@onurcatalgol8132
@onurcatalgol8132 3 жыл бұрын
Youre pretty good, justed wished you were a bit slower. and explained some of the codes a little bit more. but youre the best, thanks for the help
@bbgamingplay1511
@bbgamingplay1511 3 жыл бұрын
He is going fast because he thinks we have watched other tutorial series.
@FurryTerminator
@FurryTerminator 3 жыл бұрын
When I call check_collision() it says Breakpoint what does that mean?
@krishnawinner6935
@krishnawinner6935 4 жыл бұрын
When i write fire()its says fire in the scope isnt declared what to do
@AlphaToast27
@AlphaToast27 3 жыл бұрын
everything works perfectly except the check_collision function, i shoot at the enemies but it doesn’t seem to detect it. do you know what would cause it?
@tiagomatos5747
@tiagomatos5747 2 жыл бұрын
Me too..
@avgchoobafan
@avgchoobafan 4 жыл бұрын
really good video, but i have a problem, suddenly the camera clamp in my Player.gd no longer works, but everything else works fine, what could be?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
interesting, can you head over to our discord and post your Player.gd file? discord.gg/nzq9ZKT
@yrnteao
@yrnteao 2 жыл бұрын
is the info in this tutorial series still applicable in 3.4?
@buyrcsp2
@buyrcsp2 Жыл бұрын
I dunno if he told this in future video and if anyone is still watching this video, but if you want to make a gun thats keeps shooting when the shoot button is pressed (or an *automatic gun*), change Input.is_action_just_pressed to Input.is_action_pressed in the func fire()
@jojojoejoe9977
@jojojoejoe9977 2 жыл бұрын
Pls help. It says check_collision isnt declared in the current class. For the fire button
@aurelienagosto9106
@aurelienagosto9106 2 жыл бұрын
Hi, at 24:45 my code say that rhe fonction set_text attempt to call in base null instance
@CelineSZN
@CelineSZN 3 жыл бұрын
I keep getting a is_colliding in base null instance on a null instance pls help if you can
@lilpreso200
@lilpreso200 Жыл бұрын
on the can fire its says that the indent isnt needed
@kendralambillon9418
@kendralambillon9418 4 жыл бұрын
Hello Tom, thank you for your videos. Why function check collision does not work on my Godot? When I hit, it does not detect the enemy.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hi Kendra, can you make sure you're calling the check_collision() function. I would start by calling print('check_collision is being called') as the first line of that function to see if it is indeed being called or not.
@kendralambillon9418
@kendralambillon9418 4 жыл бұрын
@@CodeWithTom I am doing exactly the same code as in your video
@CodeWithTom
@CodeWithTom 4 жыл бұрын
@@kendralambillon9418 hi Kendra, in that case please make sure you have setup the collision polygon as shown in the video and setup the appropriate collision mask layers
@octosional
@octosional 4 жыл бұрын
I need some help. The game was working fine until I added the exact same lines of code from line 33-38 at 17:35 and then every time I clicked to fire the weapon it brings up an error message saying “Attempt to call function ‘is_colliding’ in base ‘null instance’ on a null instance” as well as “get_node: Node not found: ../Head/Camera/Raycast.”
@JusGodden
@JusGodden 4 жыл бұрын
RayCast has a capital C, about line 9 is meant to be: onready var raycast = $"../Head/Camera/RayCast"
@Mriganka2S
@Mriganka2S 4 жыл бұрын
I've been following your tutorial, but I'm getting this problem: func check_collision(): print("in_collider fn") if bullet.is_colliding(): print("is_colliding") var collider = bullet.get_collider() if collider.is_in_group("Enemies"): print("Killed" + collider.name) collider.queue_free() In the code, for some reason, isn't entering -- if collider.is_in_group("Enemies"): Any idea why? It's detecting the collisions but not identifying the group.
@anarchy3508
@anarchy3508 3 жыл бұрын
hold on i tried this but cant get the shoot collision or enemy vanishing here. have i missed something because ive followed exactly
@moreleninisttheory6046
@moreleninisttheory6046 3 жыл бұрын
i have this same problem
@uhfan22
@uhfan22 4 жыл бұрын
Nice! I subbed in order to be guided by your brilliant ideas, as game development might be really difficult for a newbie! Btw.. i'm a linux developer and i want to upload my games for android platform later in the future but i have some problems with a program called adb.. Please if you can help me, then I would like from you to make a video on how to solve this kind of issue.. Thx for reading my comment!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hey I'm so glad you're finding this content useful! I will try and cover android deployments in a later video.
@dafellachallam7384
@dafellachallam7384 2 жыл бұрын
I have a little problem It says *is_colliding is base in null instance* on a null instance
@panderz_gg
@panderz_gg 2 жыл бұрын
Same. Did you find a solution in the meantime?
@nicoservin2870
@nicoservin2870 2 жыл бұрын
I don't get the if with the can_fire part, because it can't happend can_fire =true and current_ammo>0 at the same time. Unless you mean to use can_fire for another purpose like if sprinting=true or cutscene=true: can_fire=false and then it can't shoot
@fragarena9910
@fragarena9910 4 жыл бұрын
pls make MORE :3
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Don't worry, more coming soon 😄
@kendralambillon9418
@kendralambillon9418 4 жыл бұрын
Hello, Nice videos they are useful. I have a problem... everything is going well with fire until I insert the func check_collision... When I display the game the mouse is not working for collision.. Could you help me please?
@paytonluther3356
@paytonluther3356 3 жыл бұрын
I’m having the same problem now. Did you fix if?
@rommusic9642
@rommusic9642 2 жыл бұрын
Did you fix it? I'm having the same problem
@JOKER-pi1qr
@JOKER-pi1qr 4 жыл бұрын
I have a mistake: wehn i try to reload or shoot, it is not going down the ammo bar... and when I press r it isn't als reloading also if i look at the output screen where everything is written... I don't understand pls help me. And I very like this project...
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hey there, if you're able to join the discord and send me your Player.gd script I can take a look. discord.gg/nzq9ZKT
@IGamer609
@IGamer609 2 жыл бұрын
please help, idk why but the shotgun script doesn't work at all and i think the scripts don't connect even when i put the correct class id
@geckopg3d394
@geckopg3d394 2 жыл бұрын
if you click on the weapon node in the player scene that should help
@achillesgaming8569
@achillesgaming8569 3 жыл бұрын
it says "set_text" is based in the null Instance
@melware_1869
@melware_1869 3 жыл бұрын
hero
@DoriftoDA
@DoriftoDA 4 жыл бұрын
i love your tutorial. but, why my enemies doesn't disappear when i shoot them? how to solve it?
@joaopaulogalloclaudino9671
@joaopaulogalloclaudino9671 3 жыл бұрын
having the same problem, did you solved it?
@DoriftoDA
@DoriftoDA 3 жыл бұрын
@@joaopaulogalloclaudino9671 no
@LuizAntonio_Gameplay
@LuizAntonio_Gameplay 4 жыл бұрын
Could you create an AI tutorial in C # on godot?
@beanie.weanie
@beanie.weanie 2 жыл бұрын
how do i make it so when i hold the mouse key the gun keeps shooting by itself
@matapavosgamer
@matapavosgamer 2 жыл бұрын
Use "Input.is_action_pressed" instead of "Input.is_action_just_pressed"
@volcanicember
@volcanicember 3 жыл бұрын
I know this is a kind of old video, but i did all the code right for this one i followed step by step but the raycast will not collide with anything? everytime i fire at one of the spheres it doesn't print or do anything. Halp
@panskibinski
@panskibinski 3 жыл бұрын
In my case rebuilding enemy as: [ MeshInstance with Statitc body with CollisionShape ] helped. Same as ground in video part 1
@volcanicember
@volcanicember 3 жыл бұрын
@@panskibinski Thank you! This fixed my problem pretty quickly
@matrixchronic8542
@matrixchronic8542 4 жыл бұрын
Do u need the second script or not
@bubblzjamse1599
@bubblzjamse1599 2 жыл бұрын
it did not work for me, the first tut was fine but it does not say "fired weapon" when i click
@geckopg3d394
@geckopg3d394 2 жыл бұрын
does your print statement look like this: print("Fired weapon")?
@michaelwilson814
@michaelwilson814 4 жыл бұрын
this is my code is anything wrong because when i go to fire i get an error extends Node class_name Weapon export var fire_rate = 0.5 export var clip_size = 5 export var reload_rate = 1 onready var raycast = $"../Head/Camera/RayCast" var current_ammo = clip_size var can_fire = true var reloading = false func _process(delta): if Input.is_action_just_pressed("primary_fire") and can_fire: # fire the weapon if current_ammo > 0 and not reloading: print("Fired weapon") can_fire = false current_ammo -= 1 check_collision() yield(get_tree().create_timer(fire_rate), "timeout") can_fire = true elif not reloading: print("Reloading") reloading = true yield(get_tree().create_timer(reload_rate), "timeout") current_ammo = clip_size reloading = false print("Reload complete") func check_collision(): if raycast.is_colliding(): var collider = raycast.get_collider() if collider.is_in_group("Enemies"): collider.queue_free() print("Killed " + collider.name)
@michaelwilson814
@michaelwilson814 4 жыл бұрын
I keep getting the error get_node: Node not found: /Head/Camera/Raycast. Can anyone help me with this?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hi Michael, can you double check the spelling of RayCast in your scene tree. It's case sensitive.
@paytonluther3356
@paytonluther3356 3 жыл бұрын
get_node: node not found: ../Head/Camera/RayCast Please help
@atharvvbhandare
@atharvvbhandare 3 жыл бұрын
Thanks alot Tom sir you helped me alot make my game
Interactable Objects in Godot - Make an FPS in Godot Part 3
25:39
Code with Tom
Рет қаралды 39 М.
Make Your First Game in Godot in 2020
39:38
Code with Tom
Рет қаралды 52 М.
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 10 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 57 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 60 МЛН
Can I Create Video Games Using SQL? (No Game Engine)
20:58
icitry
Рет қаралды 126 М.
How I made an Excellent Platformer
8:25
GoldenEvolution
Рет қаралды 262 М.
Using Composition to Make More Scalable Games in Godot
10:13
Firebelley Games
Рет қаралды 208 М.
6 Tips to Better Organize your Godot Projects
11:39
GDQuest
Рет қаралды 133 М.
Godot FPS Tutorial - Projectile Weapons
14:49
Garbaj
Рет қаралды 51 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 490 М.
Finite State Machines in Godot | Godot Starter Kit FSM
9:46
ForlornU
Рет қаралды 24 М.
The Art of Game Optimization
10:18
Worlds In Motion
Рет қаралды 258 М.
Godot Ray-casting tutorial: Create a simple Hitscan Weapon
6:03
Is this a Race? 😱🔥 #shorts #shortsvideo #trending #motorcycle
0:19
Подпишись❤️ Давай взрывать🚀
1:01
Рамир Хасанов
Рет қаралды 8 МЛН
#asmr #pagani #huayra #paganihuayra #supercars #fastcars #speed #cars
0:10
МИНУСЫ ВЕЛОСИПЕДА ФЭТБАЙК #shorts
0:16
Леха МАК
Рет қаралды 381 М.