Very nice, I had self implemented a hook that was quite good but did feel to OP in some cases. I fixed it by using this method of different pulling forces depending on the context. Glad to see I was on the right tracks. Thanks for the video !
This is a great guide, and very helpful! One small note: The video is way too fast, and very difficult to follow without using TH-cam's frame-by-frame scrolling. A brief pause when showing code would be much appreciated.
Thank you! I couldn't find a single tutorial with this style of grappling hook and even when I asked on the Godot discord, they wouldn't understand / instruct me on how to make one. Once again, thank you once again mate!
Just adding this in case anyone had the same issue: PROBLEM - I had a few issues with the grapple not firing where i wanted and just spinning uselessly. SOLUTION - the collision capsule on the chain was too big and was clipping into the ground. Shrank it smaller than the player's collision box and everything works now
Congratulations your source and tutorials are a poems I woold like to see more videos with GODOT make for you. Thank you very much for your effort. I don't speak english well google helps me. Now we have a 3.3 vertion Happy coding for you too
If anyone else has an issue with the hook going in the correct direction but facing the opposite way, just change where you subtract 90 degrees to make it add instead
I implemented this into my code and it works good other than the fact that it shoots only in the top left and no other direction when I copy the code letter for letter it does the same thing... any help?
I'm not sure if you figured out how to stop the grapple hook from being infinite but here is how I did it. Basically I created a "distance_traveled" variable that would start with the value of zero. Then in the process I said that "if flying == true: distance_traveled += 1" and then in the physics process on the part where it says "if flying == true: if $Tip.move_and_collide(direction * SPEED):.....(blah blah blah)" I changed the first part to "if flying == true and distance_traveled < 10: ....(blah blah blah)". You can change the 10 into any number you like and that will set the distance. This is will stop the grapple hook in mid air though so if you want it to retract you can just add in "if distance_traveled >= 10: release()". Also you will need to set distance_traveled to 0 in the release function.
@@zayler4887 nice one! Sorted me out that. Good programming practice to not have random numbers about that could be important, so I declared a variable max_time_travelled to store the value to compare with
Hey, I noticed the grapple mechanic has issues when you set and get close to the camera limits; the hook no longer moves towards the mouse accurately or just goes in another direction. How can we fix this?
is there any way to make the grapple only shoot towards were your mouse or character is looking. right now it shoots mostly towards were your mouse is pointed but will also go towards the nearest surface. any way to remove that?
Amazing video by the way I subscribed. I just had one question. In my game i have a gun on my character . how would i make it so the the chain shoots out of the gun? I dont know how the code is figuring out were to shoot the chain. sometimes its in the direction of my mouse other times it just shoots the floor? Edit: I fixed the problem i just had changed the input settings to be something diffrent and it kinda messed it up
I decided to polish the dynamic camera a bit because it was extremely rigid and buggy extends Camera2D @export var dynamicCameraEnabled: bool = true @export var minDeadZone: int @export var maxDeadZone: int var target: Vector2 = Vector2.ZERO func _process(delta): self.position = lerp(self.position, target, 0.1) func _input(event): if event is InputEventMouseMotion and dynamicCameraEnabled: var simulatedTarget = event.position - get_viewport().size * 0.5 if simulatedTarget.length() > minDeadZone: if simulatedTarget.length() < maxDeadZone: target = simulatedTarget else: target = simulatedTarget.normalized() * maxDeadZone else: target = Vector2.ZERO What this does differently (other than just making it smooth) is it adds the ability to have a max distance from the player. Instead of being able to always move the camera no matter how far away it is from the player, the camera is normalized to always be a certain distance away if the length exceeds the max. It also disables updating the target when the distance is less than the min deadzone to allow for it to actually move when the mouse is not; hence making it look much smoother. The larger the region is then the more smoothing you will have. In other words, if the min is equal to the max then there is one point that the camera will jump to instead of smoothly moving inside the region
why do you make a scene for your tiles in your map and not upload the sprite to the tile map and do the collision and tiling through the godot tilemap options?
Thanks for adding this man! I was searching for ropes mechanics where I want to use the rope as a platform to walk and run on it but if the weight exceeds the rope breaks so can you do this tutorial I am pretty stuck here
ight so I ended up figuring it out on my own and basically I created a "distance_traveled" variable that would start with the value of zero. Then in the process I said that "if flying == true: distance_traveled += 1" and then in the physics process on the part where it says "if flying == true: if $Tip.move_and_collide(direction * SPEED):.....(blah blah blah)" I changed the first part to "if flying == true and distance_traveled < 10: ....(blah blah blah)". You can change the 10 into any number you like and that will set the distance. This is will stop the grapple hook in mid air though so if you want it to retract you can just add in "if distance_traveled >= 10: release()". Also you will need to set distance_traveled to 0 in the release function.
I don't have any experience with android, but could you just replace the Input function that calls the shoot command with a tap input, and set the position like this: $Chain.shoot(get_local_tap_position))
can you make this tutorial again, it's too fast I don't understand
Very nice, I had self implemented a hook that was quite good but did feel to OP in some cases. I fixed it by using this method of different pulling forces depending on the context. Glad to see I was on the right tracks.
Thanks for the video !
This is a great guide, and very helpful!
One small note: The video is way too fast, and very difficult to follow without using TH-cam's frame-by-frame scrolling. A brief pause when showing code would be much appreciated.
Thank you so much for this grapple hook! I used it in my online game "Bazookants"!
Thank you! I couldn't find a single tutorial with this style of grappling hook and even when I asked on the Godot discord, they wouldn't understand / instruct me on how to make one. Once again, thank you once again mate!
OMFG Teeworlds. I totaly forgot about that. I absolutly loved it as a child. Thank you for reminding me.
Nice video btw, but a bit slower would be nice. Its hard do follow if its that fast.
so thankful for this. im making a new prototype and this was PERFECT
Just adding this in case anyone had the same issue:
PROBLEM - I had a few issues with the grapple not firing where i wanted and just spinning uselessly.
SOLUTION - the collision capsule on the chain was too big and was clipping into the ground. Shrank it smaller than the player's collision box and everything works now
I first saw this in a game back on NES Bionic Commando, it's awesome you can do stuff like this in Godot.
Great! I was able to incorporate this quickly into my own 2D platformer. Looking forward to the next video!
Congratulations your source and tutorials are a poems I woold like to see more videos with GODOT make for you.
Thank you very much for your effort.
I don't speak english well google helps me.
Now we have a 3.3 vertion Happy coding for you too
1:51 it's important to check off Centered guys :)
Saved me some time thanks !
@@gameanddata3194 No problem! Good luck
Thanks for the reminder, lol
"smash.....that......like"
Me: *sighs* yeah that was really good
really really good
This isn't a tutorial.
Lol
..
This is more of a ... hey look what I did and I'm not giving u all the details 😂
If anyone else has an issue with the hook going in the correct direction but facing the opposite way, just change where you subtract 90 degrees to make it add instead
this is great ! :D :D keep doing these tuts :D
Thank you for sharing this!
Do you think you can speed up your videos even more? I almost saw what you were doing for a moment
I implemented this into my code and it works good other than the fact that it shoots only in the top left and no other direction when I copy the code letter for letter it does the same thing... any help?
finally. thank you.
boss tutorial, keep it up! Thinking about how to stop it being infinite but thats a job for another day
I'm not sure if you figured out how to stop the grapple hook from being infinite but here is how I did it. Basically I created a "distance_traveled" variable that would start with the value of zero. Then in the process I said that "if flying == true: distance_traveled += 1" and then in the physics process on the part where it says "if flying == true: if $Tip.move_and_collide(direction * SPEED):.....(blah blah blah)" I changed the first part to "if flying == true and distance_traveled < 10: ....(blah blah blah)". You can change the 10 into any number you like and that will set the distance. This is will stop the grapple hook in mid air though so if you want it to retract you can just add in "if distance_traveled >= 10: release()". Also you will need to set distance_traveled to 0 in the release function.
@@zayler4887 nice one! Sorted me out that. Good programming practice to not have random numbers about that could be important, so I declared a variable max_time_travelled to store the value to compare with
Thanks max_time_traveled is also a good idea and I will implement it!
Hey, I noticed the grapple mechanic has issues when you set and get close to the camera limits; the hook no longer moves towards the mouse accurately or just goes in another direction. How can we fix this?
Very cool thanks for sharing.
Wow this is amazing (Subscribed)
I would love if you could make a video game similar to Worms
@@Crisisdarkness Finally got around to it :) th-cam.com/video/vousewr1dUA/w-d-xo.html
ive been trying for hours now and it says my hook is having errors based on a null instance i need help
Teeworlds!!
Which version of Godot did you use in this explanation??
instantly Subscription!
amazing tutorial but how do you transfer the mouse click location to the chain
amazing tutorial but can you please make a video on ropes ? like grab the rope and swing to the other side ??
that would be great please
Why you didn't make an AnimationTree?
Can you please make a Godot 4 implementation of your code?
is there any way to make the grapple only shoot towards were your mouse or character is looking. right now it shoots mostly towards were your mouse is pointed but will also go towards the nearest surface. any way to remove that?
Amazing video by the way I subscribed. I just had one question. In my game i have a gun on my character . how would i make it so the the chain shoots out of the gun? I dont know how the code is figuring out were to shoot the chain. sometimes its in the direction of my mouse other times it just shoots the floor? Edit: I fixed the problem i just had changed the input settings to be something diffrent and it kinda messed it up
subbed
great work keep it up
Invalid get index 'hooked' (on base: 'null instance'). ???
great video I've a question how can I limit the throw of the chain
check the distance between the origin and the hook, and if it crosses a threshold stop the shooting.
I decided to polish the dynamic camera a bit because it was extremely rigid and buggy
extends Camera2D
@export var dynamicCameraEnabled: bool = true
@export var minDeadZone: int
@export var maxDeadZone: int
var target: Vector2 = Vector2.ZERO
func _process(delta):
self.position = lerp(self.position, target, 0.1)
func _input(event):
if event is InputEventMouseMotion and dynamicCameraEnabled:
var simulatedTarget = event.position - get_viewport().size * 0.5
if simulatedTarget.length() > minDeadZone:
if simulatedTarget.length() < maxDeadZone:
target = simulatedTarget
else:
target = simulatedTarget.normalized() * maxDeadZone
else:
target = Vector2.ZERO
What this does differently (other than just making it smooth) is it adds the ability to have a max distance from the player. Instead of being able to always move the camera no matter how far away it is from the player, the camera is normalized to always be a certain distance away if the length exceeds the max. It also disables updating the target when the distance is less than the min deadzone to allow for it to actually move when the mouse is not; hence making it look much smoother. The larger the region is then the more smoothing you will have. In other words, if the min is equal to the max then there is one point that the camera will jump to instead of smoothly moving inside the region
Why do you use Visual Studio for Godot???
why do you make a scene for your tiles in your map and not upload the sprite to the tile map and do the collision and tiling through the godot tilemap options?
ur a god
Could you do a tutorial for rope and rope bridge.
Thanks for adding this man! I was searching for ropes mechanics where I want to use the rope as a platform to walk and run on it but if the weight exceeds the rope breaks so can you do this tutorial I am pretty stuck here
In the chain script it says "var tip_lock = to local(tip)" error
saw teeworlds
ok cool
u need more subs
how do i do the chain sprite rotation for 3D?
This completely breaks in Godot 4.0 btw
Bro 3d grappling hook?
whats the name of the game on the start i search it for so long
That's Teeworlds
does anyone know how to stop it from being infinite?
ight so I ended up figuring it out on my own and basically I created a "distance_traveled" variable that would start with the value of zero. Then in the process I said that "if flying == true: distance_traveled += 1" and then in the physics process on the part where it says "if flying == true: if $Tip.move_and_collide(direction * SPEED):.....(blah blah blah)" I changed the first part to "if flying == true and distance_traveled < 10: ....(blah blah blah)". You can change the 10 into any number you like and that will set the distance. This is will stop the grapple hook in mid air though so if you want it to retract you can just add in "if distance_traveled >= 10: release()". Also you will need to set distance_traveled to 0 in the release function.
@@zayler4887 Well, i just used raycast :P
Does it works on 3D too?
hello, how to do tutorial for android? (how to adapt this system for android)
I don't have any experience with android, but could you just replace the Input function that calls the shoot command with a tap input, and set the position like this: $Chain.shoot(get_local_tap_position))
I must have missed the "how to"...
Are you using. K=-xd
doesnt work for some reason
its bc he made it in godot 3
is the code in c*
Hay can you do this in 3d ....??? please help there is no lesson on TH-cam .....you are the last hope....
Please help...