(Aug-13-2021, 09:22 AM)Pedroski55 Wrote: Maybe create a bigger, unseen version of r0 and if it collides with a corner of r1, set that point as r0.x, r0.y ???Yes this is exactly what to do. There is a built in method for these kind of operations for Rects called inflate() and inflate_ip() (inflate in place .ie modify the original instead of creating a new rect)
I would use pygame rects for objects in classes. An original rect for its coordinates. Another inflated rect for its collision detection. You dont need to create a separate object for rect collision.
This is not a drag and drop feature, but a drag example. I think it would illustrate why use classes and will make your world a lot easier if you. It would better organize your code and make it easier for you and us to understand.
https://github.com/Mekire/pygame-samples...ag_text.py
Your code is similar to the non class code. So maybe looking at the comparisons would help in how to use classes.
https://python-forum.io/thread-34609.html
Ugggg. I wrote a longer explanation but it gave a 400 request when i edited the post so i lost it all and now have to leave. sorry.
Recommended Tutorials: