MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / Ball

Class Ball

DemoPrograms/Demo_Graph_Ball_Game.py:19–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19class Ball():
20 def __init__(self, x, y, r, graph_elem, *args, **kwargs):
21 mass = 10
22 # Create a Body with mass and moment
23 self.body = pymunk.Body(
24 mass, pymunk.moment_for_circle(mass, 0, r, (0, 0)))
25 self.body.position = x, y
26 # Create a box shape and attach to body
27 self.shape = pymunk.Circle(self.body, r, offset=(0, 0))
28 self.shape.elasticity = 0.99999
29 self.shape.friction = 0.8
30 self.gui_circle_figure = None
31 self.graph_elem = graph_elem
32
33 def move(self):
34 self.graph_elem.RelocateFigure(
35 self.gui_circle_figure, self.body.position[0], ball.body.position[1])
36
37
38class Playfield():

Callers 1

add_ballMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected