My Dude. I have been playing with pygame for months now. Got number of projects under my belt. I always find myself coming back to your vids for some assistance...This here, is a perfect example. Been looking for a means of determining line collisions...and lo and behold ... Russ has done it again!! Much appreciated man!!
@sushismitcher225 Жыл бұрын
I have needed line collisions for a project over a year ago with pygame. I've been looking for simple line collisions since. This is a deus ex machina for my project! Russ just got a new subscriber.
@DineshVaidyaOfficial Жыл бұрын
Hi! Thanks for this amazing tutorial series, they are just awesome, the way you explain is really really nice. So please keep it on and continue this series on pygame. I must say that your channel is underrated but whoever will visit your channel will definitely love and follow it. Thanks once again.
@CodingWithRuss Жыл бұрын
Thanks a lot for the kind words!
@windchaser123 Жыл бұрын
Intro 0:00 Rectangle Collisions 0:39 Point Collisions 6:12 Line Collisions 8:26
@CodingWithRuss Жыл бұрын
Nice! Thanks
@windchaser123 Жыл бұрын
@@CodingWithRuss no problem, just needed to make a reference for myself. This is a fantastic tutorial, it really helped my project!
@alboukhari20011 Жыл бұрын
I follow your lessons it're very interesting and easy to understand Thanks for your great job
@Quilonis Жыл бұрын
Small amount of likes for a really good and useful video , thanks
@michelangelorollf86082 ай бұрын
Great video, good cadence and paceing please keep making videos. And good luck on your future projects.
@CodingWithRuss2 ай бұрын
Thank you!
@SkyFly19853 Жыл бұрын
Getting interesting more and more each lesson.
@CodingWithRuss Жыл бұрын
Glad to hear it!
@SkyFly19853 Жыл бұрын
@@CodingWithRuss Indeed!
@CodingWithRuss Жыл бұрын
For the source code used in this tutorial, head over to my website: www.codingwithruss.com/pygame/top-3-collision-types-in-pygame/
@blautouristgm1936 Жыл бұрын
huge thanks, help me a lot
@CodingWithRuss Жыл бұрын
Glad to hear it helped
@Blinkers2007GameDev Жыл бұрын
Hi, I need help with something. I have made a Space Invaders game with rect collision. The enemies and the player are not rect objects. I noticed a problem with the game: The collision ONLY works if I hit the enemies on the right corners. I am using distance as my collision but colliderrect-based collision does not work either. Is it supposed to be like that with non-rectangle objects or have I done something wrong? Thank you for your answer!
@dibosh7405 Жыл бұрын
How can I tweak the position of the hitbox rectangle relative to whatever model/ sprite I'm using? Can I do that within the library or?
@CodingWithRuss Жыл бұрын
Yes, you can manually create a rectangle with pygame.Rect() and pass in the size you would like to use. Then you can draw your image using the rectangle's x and y coordinates. You may just need to offset it a little bit if it doesn't look right.
@dibosh7405 Жыл бұрын
@@CodingWithRuss Thank you. I think I get the gist. Any chance you could do a video on this, just in case? I'll play around with it until then. Cheers 😄
@albin1978 ай бұрын
for some reason the "rect_1 = pygame.Rect(0, 0, 25, 25)" is giving me "'module' object is not callable" error
@MoiLpoi8 ай бұрын
It's pygame.rect..Rect
@MoiLpoi8 ай бұрын
It's pygame.rect.Rect(a,b,c,d)
@TomatoNotTomato3 ай бұрын
You need to used double brackets (())
@TomatoNotTomato3 ай бұрын
Welp too late
@Meysamm-xi5nv Жыл бұрын
thank you so much , very helpful content
@the_art_of_thinking Жыл бұрын
Thank you so much :)
@CodingWithRuss Жыл бұрын
No problem :)
@boxhead-zk7sn Жыл бұрын
guy thanks because I made it if the box1 touch's box2 it make just basically a makeshift edge grip
@yourboizach9681 Жыл бұрын
I get collisions but I don't understand how to exactly handle them once they happen. I have a little space invaders game but instead of ships you shoot space rocks or they hit you and you die, but my ship can shoot, once a collision is detected I need to know how I can make that rock dissapear, I am currently just moving the rock back to the top so it looks like you just blow it up but I will need to actually just remove the rock from the game, how can I do this?
@witherhoard99 Жыл бұрын
@yourboizach9681 I'm assuming you have all of your rocks in a list. I'm also assuming have a method to somehow check if the rock got hit. Use a for loop. Here is some example code. for star in stars[:]: if star.got_hit_by_bullet: stars.remove(star)
@yourboizach9681 Жыл бұрын
@@witherhoard99 i figured it out, I needed to use .kill() It's a sprite group so you can't use .remove or .clear I don't think My game has actually advanced significantly since this post, I wish I could link it here somehow.
@alvarohernandez2764 Жыл бұрын
Why define all the colors as RGBs instead of just use the abailable color presets as string? For example WHITE = (225, 225, 225) pygame.draw.rect(screen, WHITE, obstacle) #instead of pygame.draw.rect(screen, "white", obstacle)
@CodingWithRuss Жыл бұрын
Both are valid and in some of my games I use the named colour presets. If you want to define your own colours though that aren't part of the defined list, it would make sense to create a variable so it could be reused in other parts of the game