Python & Pygame: Ball collision with interior of circle

前端 未结 3 543
时光取名叫无心
时光取名叫无心 2021-01-18 04:16

I\'m making a game in which balls bounce around the inside of a much larger circle. The larger circle doesn\'t move.

Here\'s the code that I\'m currently us

3条回答
  •  情歌与酒
    2021-01-18 04:43

    Most graphics packages use upper-left as start for drawing code. You most likely want 2 sets of coordinates, the one's you collide/move/etc with and the one's for drawing (x-radius, y-radius).

    Also, without having thought about it too much, should the check for intersection be distance + ball.size >= circle.size? The balls distance from the center plus its radius should be less than the circle's radius, if I understood the setup correctly.

提交回复
热议问题