Collisions between moving objects

A video about how to do collisions between objects, both static and moving ones. I will use pygame to implement it but the logic should work everywhere .
If you want to support me: / clearcode
(You also get lots of perks)
Social stuff:
Twitter - / clear_coder
Discord - / discord
Related videos:
Introduction to Pygame: • The ultimate introduct...
Deltatime: • Understanding framerat...
Timestamps:
00:00 - Intro
13:00 - Collision logic
19:32 - Collision implementation
Project file:
github.com/clear-code-project...
Pastebin:
pastebin.com/sN3vp3t9

Пікірлер: 28

  • @JohnnyGrateful
    @JohnnyGrateful Жыл бұрын

    Such a great video. Thanks for being the guy who teaches me collisions! Appreciate it all!

  • @TheBarryLight
    @TheBarryLight2 жыл бұрын

    You save my life with this tutorial :D

  • @APOSTOLARA2000
    @APOSTOLARA20002 жыл бұрын

    Very nice tutorial on basic collisions, but as you said in the end those 2 "bugs" are a pain to fix and I haven't found the optimal way to address it. I am looking foward to a more advanced collision handling video!

  • @juniorMr
    @juniorMr2 жыл бұрын

    Man ,your chanel is amazing . I watch you from Africa

  • @kingleo429

    @kingleo429

    2 жыл бұрын

    Me too. Nigeria to be precise 😉

  • @YNightmareT

    @YNightmareT

    4 ай бұрын

    How? you have no internet 😂😂😂😂

  • @mewbot346
    @mewbot3462 жыл бұрын

    Amazing!

  • @samperry8386
    @samperry83869 ай бұрын

    Thank you. My movement method is only linear up, down, left, right. I deployed your collisions function and my sprite is no longer a ghost!

  • @dmin72
    @dmin725 ай бұрын

    Thank you so much for this tutorial of such a topic so hard to find. I have been studying this topic for a long time and I had come to, more or less, your same conclusions, although less simply than your brilliant solution. However, I needed to be assured on how to order the object update and draw operations and you helped me a lot about that. Unfortunately I don't use Pyton as a programming language and I miss the implementations of the PyGame library, in particular those on sprites and collision detection between them. It would be particularly interesting to understand how to resolve bitmap collisions between transparent sprites and not just filled rectangular ones, for example. I hope one day you will want to make a tutorial about this too.

  • @WingMaster562
    @WingMaster562 Жыл бұрын

    0:32 That moment that the red block just phases through the green block as it's being pushed by the blue block. I too have this issue with multi collision

  • @subarunatsuki1902

    @subarunatsuki1902

    Жыл бұрын

    Do you found a solution?

  • @WingMaster562

    @WingMaster562

    Жыл бұрын

    @@subarunatsuki1902 I'm still working on my collisions and pathfinding. Kinda went into many phases. But for that specific part, I realized that it was described in 16:58 and 51:54 The issue is when an object is being sandwich by two objects, the latest one overrides the other. What I did from this point on was "true collision" instead: From the original position, move an entity. If there is collison with anything: Move Back to the original position then reset Velocity to 0

  • @TasteDaRDX
    @TasteDaRDX2 жыл бұрын

    Hi Chris, nice job explaining collisions. Would using Munk be more effective?

  • @Salomon_li
    @Salomon_li2 жыл бұрын

    Please make a video tutorial on how to create an isometric game, thanks!

  • @anantchandak9574
    @anantchandak95742 жыл бұрын

    That's why this is a good channel Thanks Just tell me can i make fruit ninja with pygame

  • @SkyFly19853
    @SkyFly198532 жыл бұрын

    Real nice... ✅✅✅✅✅

  • @raphaelramesar2109
    @raphaelramesar21092 жыл бұрын

    Hey, absolutely love your work. Do you know of or have any videos which use the built in vector class in Pygame? I think it’s really powerful but can’t find any videos on it. Thanks.

  • @MarcosVinicius-kn8cz
    @MarcosVinicius-kn8cz17 күн бұрын

    sou brasileiro e amo seus videos

  • @kailasmanoj2121
    @kailasmanoj21212 жыл бұрын

    Hey can you plz do a video series on KivyMD Thanks

  • @furykool
    @furykool8 ай бұрын

    I implemented this in my project and it works well but it isn’t as springy as with static and moving object collision. The player gets slowed when moving in certain areas. Is that just lag or is it fixable?

  • @SkyFly19853
    @SkyFly198532 жыл бұрын

    Btw, have you ever made a chess game in Python?

  • @trolleandopervertidos7743
    @trolleandopervertidos77432 жыл бұрын

    What's that IDE? I'm using Pycharm but the colors doesn't match

  • @batatafritanhamnham

    @batatafritanhamnham

    2 жыл бұрын

    I believe it's Sublime Text Editor, I recall him saying something about Sublime in another video. It's a great IDE, give it a try.

  • @Pieter_241
    @Pieter_2412 жыл бұрын

    666 subscribers

  • @binkrassdufass
    @binkrassdufass2 жыл бұрын

    Algo

  • @George_2983
    @George_29832 жыл бұрын

    I am the 525th person to see this video!

  • @ocoolwow
    @ocoolwow2 жыл бұрын

    This is bug filled are you going to go more in depth?

  • @amburger1984
    @amburger19842 жыл бұрын

    Im first again?