Okay, hear me out. I know I don't have the "reputation points" or whatever to ask for help here, but I'm desperate and am going to try anything I can. this is basically my last stand for this class.
I am taking a basic online class in Interactive Python Programming and this project to build a Pong clone is killing me. I already missed the last project and if I miss this one I don't know if I'll be able to pass.
The worst thing about this all is, I have almost everything working.The paddles move properly and independently and don't go off the screen, the ball spawns at a randomized vector like it should and collides with the top and bottom of the screen, the score accrues like it should...but try as I might, I cannot get the ball to collide with the paddles. It just goes straight through them. I've been able to come up with only two collision paradigms that don't make the program crash at some point, and neither of them work.
The problem is simply that in order to make the ball properly collide with the paddles, I need to test the ball's y-position against a range of y-values, which neither the lectures or the documentation cover. The class forums aren't helping either. I tried using the range() function, but it doesn't return floating point values, which is what I need to accurately test for collision.
Here is my code: http://www.codeskulptor.org/#user5-SdhbTFrT0K-2.py
It's on CodeSkulptor, which has the module SimpleGUI installed, which is what I need for this program.
I'm pretty sure things are functional otherwise, if a little clumsy. If you have advice for structuring the program better, that would be appreciated too.
Basics of CodeSkulptor:
- The "Play" button in the top-left corner runs the code.
- If you make any modifications to the code, the "Save" button next to it will become active, and you can save it. Notice the URL changes. If you have modified code that you want to show to me, you'll need to copy that URL and paste it here.
That's all I have to say for now. Hope some of you can help!
I am taking a basic online class in Interactive Python Programming and this project to build a Pong clone is killing me. I already missed the last project and if I miss this one I don't know if I'll be able to pass.
The worst thing about this all is, I have almost everything working.The paddles move properly and independently and don't go off the screen, the ball spawns at a randomized vector like it should and collides with the top and bottom of the screen, the score accrues like it should...but try as I might, I cannot get the ball to collide with the paddles. It just goes straight through them. I've been able to come up with only two collision paradigms that don't make the program crash at some point, and neither of them work.
The problem is simply that in order to make the ball properly collide with the paddles, I need to test the ball's y-position against a range of y-values, which neither the lectures or the documentation cover. The class forums aren't helping either. I tried using the range() function, but it doesn't return floating point values, which is what I need to accurately test for collision.
Here is my code: http://www.codeskulptor.org/#user5-SdhbTFrT0K-2.py
It's on CodeSkulptor, which has the module SimpleGUI installed, which is what I need for this program.
I'm pretty sure things are functional otherwise, if a little clumsy. If you have advice for structuring the program better, that would be appreciated too.
Basics of CodeSkulptor:
- The "Play" button in the top-left corner runs the code.
- If you make any modifications to the code, the "Save" button next to it will become active, and you can save it. Notice the URL changes. If you have modified code that you want to show to me, you'll need to copy that URL and paste it here.
That's all I have to say for now. Hope some of you can help!

Comment