I am developing a primitive game by python tkinter (I use canvas). It's not a big project. It's only my own self-challenge to create a game using only tkinter and standard python libraries. My problem is colliders. I need to detect collisions of game objects. First I used a circle collider (it's easy). But using only circles in a game is not good, so I decided to use polygonal or elliptical colliders, but I don't know how to do it without external libraries such as pygame. Could anyone help me?

My question shorter:

How to detect polygons' or ellipses' collisions in python tkinter canvas using only standard libraries?

P.S. And how to detect collisions of an inclined rectangle?

  • 1
    \$\begingroup\$ You might want to simplify your problem by using joined boxes instead of polygons, and by using circle+box+circle (a capsule) instead of ellipses. \$\endgroup\$ – Vaillancourt Jul 2 '19 at 19:11
  • \$\begingroup\$ Why would implementing polygonal/elliptical/oriented rectangle colliders in Python TkInter be fundamentally different from implementing them in any other language? The math is all the same. What research have you done on this topic so far, and how have you tried implementing the collision detection math in your own code? Where specifically did you get stuck? \$\endgroup\$ – DMGregory Jul 2 '19 at 23:30
  • \$\begingroup\$ I don't think that a collider on python is fundamentally different from the collider in another language. But there are many languages (not python) which have a turnkey colliders, and it's not a solution for my problem. About the second question (where did I get stuck): I haven't any idea about not-circle colliders, and my whole code is too large for posting here. \$\endgroup\$ – Gleb Smirnov Jul 3 '19 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.