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...

Комментарии • 48

  • @shravan170
    @shravan170 13 дней назад

    This is literally one of the good tutorials out there. Never did I once loose track of the code logic. Amazing!

  • @NachoKsp
    @NachoKsp 6 месяцев назад +4

    Great explanation, I love how clear you teach and how organised everything is

  • @psyboyo
    @psyboyo 5 месяцев назад +3

    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.

    • @CodingWithRuss
      @CodingWithRuss  5 месяцев назад +2

      Thank you! I thought people would be bored of watching me type, but maybe not :)

    • @psyboyo
      @psyboyo 5 месяцев назад +1

      @@CodingWithRuss And editing the video for the effect, surely takes you a lot of time ^^;;

    • @shravan170
      @shravan170 13 дней назад

      I like the fact that the video is condensed, saves a lot of time. But I understand what you are going for.

  • @mil5815
    @mil5815 6 месяцев назад +2

    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?

    • @CodingWithRuss
      @CodingWithRuss  6 месяцев назад +1

      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 🤦‍♂

  • @ashleybennett7793
    @ashleybennett7793 3 месяца назад +1

    Just finished this tutorial. It was fantastic! Thank you

  • @ivanzuccarino6894
    @ivanzuccarino6894 2 месяца назад +1

    Amazing video, very intresting, funny and with a clear explanation! Greetings from Italy!

  • @roddy_21_25
    @roddy_21_25 6 месяцев назад +2

    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.

    • @CodingWithRuss
      @CodingWithRuss  6 месяцев назад

      Thanks! That's a really good suggestion :)

  • @sergeiseniuto627
    @sergeiseniuto627 14 дней назад +1

    Love your lessons.❤❤❤

  • @pliniofigueiredo5333
    @pliniofigueiredo5333 5 месяцев назад

    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).

  • @Lansamatv
    @Lansamatv 5 месяцев назад +1

    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

  • @uaint1stulast323
    @uaint1stulast323 4 месяца назад

    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)

  • @tassosmig7091
    @tassosmig7091 25 дней назад

    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?

  • @mikerowlands1043
    @mikerowlands1043 2 месяца назад +1

    Fantastic tutorial! Exactly what I needed for my physics game. Thank you.

  • @Frustratedhen
    @Frustratedhen 6 месяцев назад +2

    Great video and explain❤ that's really great 😮😮

    • @CodingWithRuss
      @CodingWithRuss  6 месяцев назад +1

      Thanks!

    • @Frustratedhen
      @Frustratedhen 6 месяцев назад

      @@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

  • @rezashir3873
    @rezashir3873 6 месяцев назад +1

    you are always amazing

  • @notcarbuncle1493
    @notcarbuncle1493 Месяц назад

    do you think its possible to follow this tutorial with a 3d implementation?

  • @emmagetsu7369
    @emmagetsu7369 5 месяцев назад

    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 ❤

  • @MichaelGame_Dev
    @MichaelGame_Dev 3 месяца назад

    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?

    • @CodingWithRuss
      @CodingWithRuss  3 месяца назад

      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.

  • @eduardoalves3123
    @eduardoalves3123 6 месяцев назад

    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?

  • @luijininja7369
    @luijininja7369 2 месяца назад

    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?

    • @luijininja7369
      @luijininja7369 2 месяца назад

      I was running the Table as the scene instead of the Main. Its fixed now.

  • @nicholasmello1337
    @nicholasmello1337 2 месяца назад

    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

    • @CodingWithRuss
      @CodingWithRuss  2 месяца назад

      I used Godot 4 for this tutorial so it may be that some features won't work on Godot 3.

    • @nicholasmello1337
      @nicholasmello1337 2 месяца назад

      @@CodingWithRuss haves it a solution?

    • @nicholasmello1337
      @nicholasmello1337 2 месяца назад

      @@CodingWithRuss i'm an amateur in this

    • @CodingWithRuss
      @CodingWithRuss  2 месяца назад

      @@nicholasmello1337I'm not sure, I never used Godot 3, sorry.

  • @pabloantonio5003
    @pabloantonio5003 6 месяцев назад

    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

  • @carlonsantosalberto3590
    @carlonsantosalberto3590 6 месяцев назад

    podes hacer un tutorial de bomberman gracias

  • @TheGenjutsuGod
    @TheGenjutsuGod 5 месяцев назад +1

    can we make these games in Android ? Please reply

    • @CodingWithRuss
      @CodingWithRuss  5 месяцев назад +1

      Yes I'm pretty sure Godot allows you to export to android, but I've never tried it.

    • @TheGenjutsuGod
      @TheGenjutsuGod 5 месяцев назад +1

      @@CodingWithRuss ohh yeah can I make these in pydroid it's an IDE for python
      And thanks for replying

  • @Lansamatv
    @Lansamatv 5 месяцев назад

    you can improve this game add online multiplayer

  • @ericwood1185
    @ericwood1185 6 месяцев назад +1

    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)

    • @CodingWithRuss
      @CodingWithRuss  6 месяцев назад +1

      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.