How to Make Pool (Billiards) Using Godot's Physics Engine | Godot Tutorial
HTML-код
- Опубликовано: 31 май 2024
- Learn how to work with physics objects in Godot by creating a pool game.
The game will use three of the four godot 2D collision objects - Area2D, StaticBody2D and RigidBody2D.
I will customise the physics properties of the objects but won't code any physics in the script, this will all be done by godot's physics engine.
Code and assets for this video: github.com/russs123/Pool_tut
Credits for images: opengameart.org/content/8-bal...
This is literally one of the good tutorials out there. Never did I once loose track of the code logic. Amazing!
Great explanation, I love how clear you teach and how organised everything is
Thanks!
This is poetry! But I miss seeing you typing the code, it gives that... humane touch, even a pause between explanations, a less dense discourse.
Thank you! I thought people would be bored of watching me type, but maybe not :)
@@CodingWithRuss And editing the video for the effect, surely takes you a lot of time ^^;;
I like the fact that the video is condensed, saves a lot of time. But I understand what you are going for.
Without a doubt one of the best, most entertaining and educational tutorials I have seen. Worth seeing from the first to the last minute. Thanks for that and it's a shame that there are so few good tutorials, especially in the Godot area beyond the "platformers".
Just a question or note: when calculating the "power" in your tutorial, the distance of the mouse cursor also plays a crucial role. Is that intentional?
Thank you! That's great to hear.
I checked the code again and you are right! The variable "dir" in line "shoot.emit(power * dir)" should be normalized()!. This reduces the overall power so it would need to be multiplied by a factor (say 100) to make the shot powerful again but would mean the power isn't linked to the distance.
I missed that when I was making the game because I always position the cursor over the ball that i am aiming at 🤦♂
Just finished this tutorial. It was fantastic! Thank you
Thanks! Glad you liked it
Amazing video, very intresting, funny and with a clear explanation! Greetings from Italy!
Thank you!
i love your videos :) i dont tend to code video games but i like to watch others people do. so, i just a recomendation, if you can, dont just upload the long tutorial, upload a short version of how you made the game too, like the video of your history coding video games on python with pygame. something short, because there are people like me, that love your content and like to watch short videos without learn the main concepts of programming a game.
Its just my oponion, but, have a nice day and continue with your channel :) i love your videos.
Thanks! That's a really good suggestion :)
Love your lessons.❤❤❤
Thanks!
great video! Just one comment, if you lock the rotation of the balls when they bounce of the walls they tend to ignore the angle they were going and end up bouncing straight forward (like what happens at 31:52 with the yellow ball).
I would like the balls to be a little more fluid when rolling, also teach us to add a store to buy cues, table skins, avatar and so on, also a store to buy gems, but when you finish the tutorials in mind to improve the billiards later
Outstanding tutorial thank you... (about 45:05) Not sure if I did something different/wrong but I had to change b.position to b.offset to update the Sprite2D Vector2 location on screen. (Godot 4)
Thanks for the tutorial, I have reprogrammed the game in C# and made some changes. I would now like to add something like a line on the target ball that shows the direction of the target ball before the ball is hit by the cue ball depending on the direction of the cue. Do you have an approach for this or is there a method?
Fantastic tutorial! Exactly what I needed for my physics game. Thank you.
Glad it came in useful :)
Great video and explain❤ that's really great 😮😮
Thanks!
@@CodingWithRuss hy friend can you make chess game or you are making any game can you add touch input so we can install that app in Android and run
you are always amazing
Thanks :)
do you think its possible to follow this tutorial with a 3d implementation?
I love your videos, you are the best, I would like you to expand and add more things like the 8 pool ball from miniclip, so a store, multiplayer and please ❤
I was curious, early on when talking about tunneling, you mention that one option would be to use a more sophisticated method of determining collisions. Could you give me an idea of what that would even look like? Like, what would I need to look up to find more info on possible methods to try?
I didn't have anything specific in mind when I mentioned that, but one thing could be to project a line from the ball in the direction of the shot, then check for collision between that line and the cushions. You could then work out the coordinates of that collision and potentially the angle as well using Vectors. I haven't got a specific example but off the top of my head that could be a way of doing it. You would essentially be doing the collision checks manually yourself instead of relying on the built in physics engine at that point so that's why it is more complicated.
hello, bro. Man... Im strugling in how to do dialog with npcs in pygame. I don't know how to do it and I don't find nothing in web. You know how can I do it? Would you make a video one day about it?
I followed the code at generating pool balls, but none of the balls generated. Is there a reason for this or did I mess up somewhere?
I was running the Table as the scene instead of the Main. Its fixed now.
i'm trying make a southern bocce game based in this tutorial, but i don't have sucess with the Cue part and the shoot function. The cue ball don't apply central impulse. Could you help me with that?
i'm using godot 3.3.3.
sorry the bad english, i'm brazilian
I used Godot 4 for this tutorial so it may be that some features won't work on Godot 3.
@@CodingWithRuss haves it a solution?
@@CodingWithRuss i'm an amateur in this
@@nicholasmello1337I'm not sure, I never used Godot 3, sorry.
to start a new game, why didn't you just reload the main scene? mighta been way easier than taking care of the new game function
podes hacer un tutorial de bomberman gracias
can we make these games in Android ? Please reply
Yes I'm pretty sure Godot allows you to export to android, but I've never tried it.
@@CodingWithRuss ohh yeah can I make these in pydroid it's an IDE for python
And thanks for replying
you can improve this game add online multiplayer
Awesome love it , but im having an error when i pot the cue ball,
Attempt to call function 'apply central impulse' in base 'previously freed' on a null instance
func _on_cue_shoot(power):
cue_ball.apply_central_impulse(power)
Potting the cue ball gave me some issues as well. The error that you're getting is different to what I had though. It seems like the cue ball is being deleted so it then throws an error when it tries to apply an impulse to it. Are you resetting the cue ball after you delete it? That would prevent this error.