I am implementing a python and kivy application from a basketball pitcher. And I need help at the starting point.
Initially there was only one basket to reach now I need to implement a table. The problem is that my program analyzes my picture of the basket as a square and needs it to be analyzed as a "ladder" in order to create a condition within the basket class to identify the collision. If you can help me, I'd appreciate it. If there is any information missing or misrepresented please inform me.
The code is being developed in another language (Portuguese) but I tried to translate the terms posted to English.
I honestly do not know how to start.
Basket class on python:
class basket(Widget): tolerance = 20 offsetX = 50 offsetY = 100 def position(self, x, y): self.pos = x, y self.target = self.pos + self.offsetX, self.pos + self.offsetY def CheckBall(self, ball): if ball._y < ball.y0: ball.status = "resting on the floor" return False if (self.target - self.tolerance < ball._x + ball.raio < self.target + self.tolerance) and (self.target - self.tolerance < ball._y + ballraio < self.target + self.tolerance): ball.status = "hit the basket" return False print("Centro Bola = (", ball._x+ball.raio, ",", ball._y + ball.raio, "), Target = ", self.target) return True
#Ball <Ball>: size: 50, 50 canvas.after: Color: rgba:1, 1, 1, 1 Ellipse: pos: self.pos size: self.size source:'./ball.png' #Basket <basket>: canvas.before: Rectangle: pos: self.pos size: (100, 100) source: './basket.png'
I hope to be able to identify the basket table in the image to create a collision condition.