[Tkinter] how do i check if two objects are overlapping?

[Tkinter] how do i check if two objects are overlapping?

Postby dannyxy » Mon Apr 22, 2013 9:34 am

Lets say i have two objects in a canvas with tags 'missile' and 'alien'. How do check it if missile collides with alien?
dannyxy
 
Posts: 18
Joined: Fri Mar 29, 2013 11:26 am

Re: [Tkinter] how do i check if two objects are overlapping?

Postby metulburr » Thu Apr 25, 2013 2:00 am

i didnt get too far in tkinter for that, but what i found numerous times on google is:
Code: Select all
metulburr@ubuntu:~$ python3
Python 3.2.3 (default, Oct 19 2012, 20:10:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> help(tkinter.Canvas.find_overlapping)

Code: Select all
find_overlapping(self, x1, y1, x2, y2)
    Return all items which overlap the rectangle
    defined by X1,Y1,X2,Y2.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1473
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY


Return to Game Development

Who is online

Users browsing this forum: Bing [Bot] and 2 guests