This is one of the UA-cam channel that needs attention guys please share as much as possible. This man is really incredible and awesome. I've seen many youtubers but I never felt attracted towards their teaching than I did with le master tech channel. There is something magical about this channel. So I hope people who see my comment would definitely hit the link share and subscribe button
fun coding along on this project. One thing I noticed and not sure how this can be corrected, but when one ball is on top of another ball, when you select one, it selects both.
Hi this is an easy fix you can just go into the mouse button down code and change the code to a for loop that will check if each ball is selected, but only check If selected = false, that way once it finds one it will stop looking!
Smashing it, the hard work's paying off my man! Almost at 4K subs then you'll be aiming for 5K! Really enjoying your videos, even if I'm not commenting on all of them, this one was awesome!
Thanks so much Dale!! Can’t wait to hit the big milestones but enjoying the process too! I feel like I’m getting a lot more proficient at big python productions and I’d like to keep mixing in C++ and arduino but dang it python content always does so much better 😂 appreciate your support as always man! I’m glad you liked this one too! Cheers my friend!
Hey, amazing and informative video, I've been searching for something this good for quite some time now. I appreciate u learning it to other people, it's really helpful. I've watched this video all the way thru and prob spendt about 2 hours doing, understanding and learning from u. this is not the first video I've seen of u, amazing work all the way thru!. I see ur almost at 10k subs, and I subbed, so now ur 1 step closer and I would love to be on this journey with u. I got a question, would u mind maybe showing how to make some type of rocket that starts on the ground level, where it takes of and flies up in the air with fuel, and when the fuel runs out it goes back to the ground with the gravity we made. like maybe make it realistic. maybe put in gravity, air-resistance, and so on. thank u so much for all ur help!
Hey thanks so much for that super nice comment!! I would love to do a rocket launch simulation game at some point with some realistic physics! I have thought about that a few times before and it would be a lot of fun, but definitely a ton of work to put together, I can start building it out and see if it’s feasible!! 😊
Hi, I have a small question, I don't know how to put picture on object ( like giving the balls in your video a skin ). Please help me if you know, thank you so much !
Hi - you would need to use screen.blit(ball_img, (Xcoord, ycoord)) and make your coords the same as the ball - you could define your circle as a surface then draw an image onto the ball surface! PyGame doesn’t have an amazing way to do this natively like a full game engine!
@@lemastertechThanks for your answer, but Im new to pygame so I couldn’t understand it clearly. I would like to have your discord so I can get your help directly ! Hope to receive your answer
@@lemastertech thanks for the reply, can i ask how to define the circle pls? i did the screen.blit(..(ball.x_pos,ball.y_pos)) but it draws at the center of the circle and behind its
hi, i was also wondering on how to make the balls collide with each other, obvi with physics in the collition between the balls aswell. and not to take to much of ur time, but I am quite new to programming, in school we had to chose a project to work with, and now I have chosen to make a "pool" game, but I do need real physics and I was wondering if u could try and make something similar to a pool game which can help and guide me and getting better at programming.
That’s a very cool idea but I will not lie to you I am super busy these days! I have a new baby and started a new job recently so I’m struggling to keep up with huge projects! You should check out the UA-cam channel coding with Russ - I think his channel is brilliant and he did a pool in Godot tutorial I believe!
wow thank u for that@@lemastertech, I wish u luck with the baby and work and thank u for taking ur time to tell me where I could find it! have a nice day
Hi, I know it might be a bit to late, but I'm having an issue. I'm stuck at the moment of drawing the circle, but instead I've made my own image of the circle and I want to load that image and make it appear on screen, but I'm not sure how to do that. Which I mean is that I know about the whole pygame.image.load but i have no clue how to make it work with the whole class situation
HI, youll want to pass the image of the ball in as another variable when you create new classes similar to size and coef. of friction and everything else, then to draw it on the screen just use screen.blit(img) - it will try to draw the image from the top right, but if you keep everything else about the code the same you can just shift the screen.blit(img) back and up by the radius of the ball and your collision and everything else should still work!
@@lemastertech dude thats awesome I actually made a model to simulate circular motion with centripetal force from a gravitational field, really fun doe I wanted to implement conservation of momentum but I only managed to simulate collision between planets/ balls by exchanging their velocities (in a perfect collision) but it lead to some weird combinations of bounces.
Thanks! In my version that I built a few more features into I used that in collision detection so I could update both ball’s directions only once. Since any time you do physics accurate collision detection, both balls would register a collision, you only want to do math once to each to update their new speed vectors so I used ID to check what ids of balls colliding and to not update them twice!
If I wanted to make a new ball on a button press, and eventually would end up with like 200 balls, do I need to write "button200.update() etc" for each one by hand? Thanks. Really helpful vid btw👍
Hey, thanks for the video! Very informative! I do have a question. I'm working on a platformer (using a coding style similar to @CodingwithRuss), and I want to add a ball for the player to push around. I, now, want the ball to roll if it gets too close to an edge of a ground tile. Is there a way to implement this (preferably without drastically changing too much code)?
Hi! Thanks for watching and I love @codingwithruss ‘s channel and know the series you’re talking about! I think the best way to put a pushable ball into the game would be to add a ball class that has similar collision mechanics to the player in terms of ground and gravity, then just make it to where the ball has an x velocity of zero unless the player rect is colliding with the rect for the ball! I hope this helps - sounds like a fun project! Good luck :)
gravity = .5 stop_ball = 1.5 # GOAL # far cadere la pallina e, attraverso la gravità fermarla class Ball: def __init__(self, color, radius, x_pos, y_pos, x_speed, y_speed, brake): self.color = color self.radius = radius self.x_pos = x_pos self.y_pos = y_pos self.x_speed = x_speed self.y_speed = y_speed self.brake = brake self.in_air = True def draw(self): pygame.draw.circle(wn, self.color, (int(self.x_pos), int(self.y_pos)), self.radius) def manage_forces_ball(self): if self.y_pos < WN_SIZE[1] - self.radius: self.y_speed += gravity else: self.y_pos = WN_SIZE[1] - self.radius # Se la velocità verticale è sopra la soglia, applica il freno if self.y_speed > stop_ball: self.y_speed *= -self.brake else: # Anche la velocità orizzontale può essere fermata se molto bassa if abs(self.y_speed)
Hi I’m sorry I really don’t have the time to throw this code into an IDE and troubleshoot for you! You could always add some code where if the ball gets below a certain speed just stop it!
This is one of the UA-cam channel that needs attention guys please share as much as possible. This man is really incredible and awesome. I've seen many youtubers but I never felt attracted towards their teaching than I did with le master tech channel. There is something magical about this channel. So I hope people who see my comment would definitely hit the link share and subscribe button
Thank you so much!! that's a super nice comment, I really appreciate the support!
Bro you cool as hell! I now feel confident using pygame to create physics simulations and games! Keep up the good work!
Thank you so much! Nice to have you here and I’m glad it was helpful!!
fun coding along on this project. One thing I noticed and not sure how this can be corrected, but when one ball is on top of another ball, when you select one, it selects both.
Hi this is an easy fix you can just go into the mouse button down code and change the code to a for loop that will check if each ball is selected, but only check If selected = false, that way once it finds one it will stop looking!
ive recently been wanting to make some physics stuff but i didnt know where to start, this is very helpful thanks
Thanks for watching glad you found the channel!!
Smashing it, the hard work's paying off my man! Almost at 4K subs then you'll be aiming for 5K! Really enjoying your videos, even if I'm not commenting on all of them, this one was awesome!
Thanks so much Dale!! Can’t wait to hit the big milestones but enjoying the process too! I feel like I’m getting a lot more proficient at big python productions and I’d like to keep mixing in C++ and arduino but dang it python content always does so much better 😂 appreciate your support as always man! I’m glad you liked this one too! Cheers my friend!
You deserve a lot more views for this work my friend. Five stars. Thank you!
Thanks so much Dr B from Earth!! I’m glad you found it useful, I don’t worry too much about views UA-cam is a long term game it seems :)
amazing wow... realistic friction.
Thanks for watching!! Glad you liked it!
Good stuff, I really like how you broke everything down with the code and explained it.
Thanks Mike!!
Thank you! This helped me with a project I had wanted to make!
Awesome so glad it helped you thanks for watching!
did you make the video on the advanced physics? great video!
I have not yet! I have such a long todo list of future videos haha! Thanks for watching :)
Hey, amazing and informative video, I've been searching for something this good for quite some time now. I appreciate u learning it to other people, it's really helpful. I've watched this video all the way thru and prob spendt about 2 hours doing, understanding and learning from u. this is not the first video I've seen of u, amazing work all the way thru!. I see ur almost at 10k subs, and I subbed, so now ur 1 step closer and I would love to be on this journey with u. I got a question, would u mind maybe showing how to make some type of rocket that starts on the ground level, where it takes of and flies up in the air with fuel, and when the fuel runs out it goes back to the ground with the gravity we made. like maybe make it realistic. maybe put in gravity, air-resistance, and so on. thank u so much for all ur help!
Hey thanks so much for that super nice comment!! I would love to do a rocket launch simulation game at some point with some realistic physics! I have thought about that a few times before and it would be a lot of fun, but definitely a ton of work to put together, I can start building it out and see if it’s feasible!! 😊
Hi, I have a small question, I don't know how to put picture on object ( like giving the balls in your video a skin ). Please help me if you know, thank you so much !
same
Hi - you would need to use screen.blit(ball_img, (Xcoord, ycoord)) and make your coords the same as the ball - you could define your circle as a surface then draw an image onto the ball surface! PyGame doesn’t have an amazing way to do this natively like a full game engine!
@@lemastertechThanks for your answer, but Im new to pygame so I couldn’t understand it clearly. I would like to have your discord so I can get your help directly ! Hope to receive your answer
@@lemastertech thanks for the reply, can i ask how to define the circle pls? i did the screen.blit(..(ball.x_pos,ball.y_pos)) but it draws at the center of the circle and behind
its
hi, i was also wondering on how to make the balls collide with each other, obvi with physics in the collition between the balls aswell.
and not to take to much of ur time, but I am quite new to programming, in school we had to chose a project to work with, and now I have chosen to make a "pool" game, but I do need real physics and I was wondering if u could try and make something similar to a pool game which can help and guide me and getting better at programming.
That’s a very cool idea but I will not lie to you I am super busy these days! I have a new baby and started a new job recently so I’m struggling to keep up with huge projects! You should check out the UA-cam channel coding with Russ - I think his channel is brilliant and he did a pool in Godot tutorial I believe!
wow thank u for that@@lemastertech, I wish u luck with the baby and work and thank u for taking ur time to tell me where I could find it! have a nice day
Hi, I know it might be a bit to late, but I'm having an issue. I'm stuck at the moment of drawing the circle, but instead I've made my own image of the circle and I want to load that image and make it appear on screen, but I'm not sure how to do that.
Which I mean is that I know about the whole pygame.image.load but i have no clue how to make it work with the whole class situation
HI, youll want to pass the image of the ball in as another variable when you create new classes similar to size and coef. of friction and everything else, then to draw it on the screen just use screen.blit(img) - it will try to draw the image from the top right, but if you keep everything else about the code the same you can just shift the screen.blit(img) back and up by the radius of the ball and your collision and everything else should still work!
@@lemastertech Thanks a lot!
bro would deifntley like to look at the cocnservetion if momentum and conservatuon of energy
That’s a great idea! Will get working on it
@@lemastertech dude thats awesome I actually made a model to simulate circular motion with centripetal force from a gravitational field, really fun doe I wanted to implement conservation of momentum but I only managed to simulate collision between planets/ balls by exchanging their velocities (in a perfect collision) but it lead to some weird combinations of bounces.
Good content
Thank you, thanks for watching, glad you liked it!
Great video! I'm curious what the id, in the Ball class, could be used for.
Thanks! In my version that I built a few more features into I used that in collision detection so I could update both ball’s directions only once. Since any time you do physics accurate collision detection, both balls would register a collision, you only want to do math once to each to update their new speed vectors so I used ID to check what ids of balls colliding and to not update them twice!
If I wanted to make a new ball on a button press, and eventually would end up with like 200 balls, do I need to write "button200.update() etc" for each one by hand? Thanks. Really helpful vid btw👍
Hi you could just add every ball you make to a list and just run a for loop for item in list item.update()!
ball has no attribute update_pos i am so confused ive checked everything and i cant figure out whats wrong
Maybe you just forgot the parentheses when you call update_pos() ?
Balls huh...nice!
I’ve got the best balls in town!
@@lemastertech yea i rule my towns were i come from..😎
Can you make a tutorial on sprite class
That’s a good idea! I’ll start putting one of those together and might do it for an upcoming tutorial!
@@lemastertech thank you
please use elif instead of else if in your check_gravity method
No it’s too late
Hey, thanks for the video! Very informative! I do have a question. I'm working on a platformer (using a coding style similar to @CodingwithRuss), and I want to add a ball for the player to push around. I, now, want the ball to roll if it gets too close to an edge of a ground tile. Is there a way to implement this (preferably without drastically changing too much code)?
Hi! Thanks for watching and I love @codingwithruss ‘s channel and know the series you’re talking about! I think the best way to put a pushable ball into the game would be to add a ball class that has similar collision mechanics to the player in terms of ground and gravity, then just make it to where the ball has an x velocity of zero unless the player rect is colliding with the rect for the ball! I hope this helps - sounds like a fun project! Good luck :)
Nice, but why not use pymunk?
Mostly cuz I’m not that familiar with pymunk! But I also enjoy figuring modules out for myself unless it’s like ridiculous amounts of work haha
My balls list is a left/right boolean.
How could the list be a Boolean?
It means that 🏀 🚀 🏀
thanks
You’re welcome, glad you liked it, thanks for watching!
Un bellissimo video, grazie
grazie mille per la visione e per il bel commento!
wowwwwwwww!
Hope you liked it! Thanks for watching!!
gravity = .5
stop_ball = 1.5
# GOAL
# far cadere la pallina e, attraverso la gravità fermarla
class Ball:
def __init__(self, color, radius, x_pos, y_pos, x_speed, y_speed, brake):
self.color = color
self.radius = radius
self.x_pos = x_pos
self.y_pos = y_pos
self.x_speed = x_speed
self.y_speed = y_speed
self.brake = brake
self.in_air = True
def draw(self):
pygame.draw.circle(wn, self.color, (int(self.x_pos), int(self.y_pos)), self.radius)
def manage_forces_ball(self):
if self.y_pos < WN_SIZE[1] - self.radius:
self.y_speed += gravity
else:
self.y_pos = WN_SIZE[1] - self.radius
# Se la velocità verticale è sopra la soglia, applica il freno
if self.y_speed > stop_ball:
self.y_speed *= -self.brake
else:
# Anche la velocità orizzontale può essere fermata se molto bassa
if abs(self.y_speed)
Hi I’m sorry I really don’t have the time to throw this code into an IDE and troubleshoot for you! You could always add some code where if the ball gets below a certain speed just stop it!
@@lemastertech fixed it, thank you anyway