How to Make Objects Move in PyGame!

Поділитися
Вставка
  • Опубліковано 8 вер 2024

КОМЕНТАРІ • 11

  • @rethanon
    @rethanon 5 місяців тому +1

    Great job as usual!

  • @willwillcode7568
    @willwillcode7568 7 місяців тому +1

    This is actually sick! I have always found It quite hard to animate characters in pygame.This was super helpful for my games!

    • @lemastertech
      @lemastertech  7 місяців тому

      Thanks Will!! Glad you liked it 😁

  • @sweet-keeks
    @sweet-keeks 7 місяців тому +1

    Your videos are great!! I love the content and have been following along with your tutorials to learn python.

    • @lemastertech
      @lemastertech  7 місяців тому +1

      Thank you so much I’m very glad you’ve been enjoying them 😊

  • @holon4662
    @holon4662 7 місяців тому +1

    Hey man. I am trying hard to make simple 2d balls collide and bounce off in a realistic way. I use a mask to get a pixel perfect collision detection, I calculate the collision angle and do some quite extended vector calculations to modify the velocity vectors of both balls to bounce them of. And most of the time my code works. But every now and then the balls just move through each other instead of bouncing off. And I can't find the origin of that "bug". Do you have any experience with physics based, realistic collisions in pygame?
    Most solutions I found on the internet just use the mask to reverse the velocity vector once a collision is detected. That is effective and seems to work always. But it disregards correct bounce angles. And I really want to have them.

    • @lemastertech
      @lemastertech  7 місяців тому

      Hi that is a super interesting project and problem you’re having! I made a project to solve for angular momentum and conservation of energy of collisions in non perfectly elastic systems back in college but that was about 7 years ago, I’m afraid I wouldn’t know how to help you with this particular issue of Messing up the collisions I’m sorry!

    • @jimmyzurcher947
      @jimmyzurcher947 6 місяців тому

      Hi, not knowing more details about your setup, I’ll try a wild guess which might not be relevant. Sorry if that’s the case. I experienced sometimes similar bugs and it was sometimes due to the high speed of objects versus size of them, so within one frame step it could cross the other object if you were unfortunate (or enough to go through the collision criteria if using centre or rectangle for example). The solution could be to increase FPS and slow down speed for example to keep the physics the same but increase time resolution. Just an idea to test ;)