當前位置: 首頁>>代碼示例>>Python>>正文


Python Rect.overlaps方法代碼示例

本文整理匯總了Python中rect.Rect.overlaps方法的典型用法代碼示例。如果您正苦於以下問題:Python Rect.overlaps方法的具體用法?Python Rect.overlaps怎麽用?Python Rect.overlaps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rect.Rect的用法示例。


在下文中一共展示了Rect.overlaps方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_temp

# 需要導入模塊: from rect import Rect [as 別名]
# 或者: from rect.Rect import overlaps [as 別名]
def test_temp(yy,xx,place):
    nw=Rect(Point(0,0),Point(CITY_SIZE_X/2,CITY_SIZE_Y/2))
    ne=Rect(Point(CITY_SIZE_X/2,0),Point(CITY_SIZE_X,CITY_SIZE_Y/2))
    sw=Rect(Point(0,CITY_SIZE_Y/2),Point(CITY_SIZE_X/2,CITY_SIZE_Y))
    se=Rect(Point(CITY_SIZE_X/2,CITY_SIZE_Y/2),Point(CITY_SIZE_X,CITY_SIZE_Y))
    if(xx==0)and(yy==0):
        if(not nw.overlaps(place)):
            print('errore micidiale 1');
    if(xx==0)and(yy==1):
        if(not ne.overlaps(place)):
            print('errore micidiale 2');
    if(xx==1)and(yy==0):
        if(not sw.overlaps(place)):
            print('errore micidiale 3');
    if(xx==1)and(yy==1):
        if(not se.overlaps(place)):
            print('errore micidiale 4');
開發者ID:uneekone,項目名稱:fantasy-city-planner,代碼行數:19,代碼來源:fcp.py

示例2: test_temp

# 需要導入模塊: from rect import Rect [as 別名]
# 或者: from rect.Rect import overlaps [as 別名]
def test_temp(yy,xx,place):
	CX=config['CITY_SIZE_X']
	CY=config['CITY_SIZE_Y']

	# Make 4 rectangles, one for each qudrant
	nw=Rect(Point(0,0), Point(CX//2, CY//2))
	ne=Rect(Point(CX//2,0), Point(CX//2,CY//2))
	sw=Rect(Point(0,CY//2), Point(CX//2,CY))
	se=Rect(Point(CX//2,CY//2), Point(CX,CY))

	if(xx==0)and(yy==0):
		if(not nw.overlaps(place)):
			return 1
	if(xx==0)and(yy==1):
		if(not ne.overlaps(place)):
			return 2
	if(xx==1)and(yy==0):
		if(not sw.overlaps(place)):
			return 3
	if(xx==1)and(yy==1):
		if(not se.overlaps(place)):
			return 4
	return False
開發者ID:DangerBlack,項目名稱:fantasy-city-planner,代碼行數:25,代碼來源:fcp.py

示例3: range

# 需要導入模塊: from rect import Rect [as 別名]
# 或者: from rect.Rect import overlaps [as 別名]
#CREAZIONE EDIFICI RURALI

for i in range(0,len(PLACESN)):
    #place=createPlacePoint(Point(int(CITY_SIZE_X/2),int(CITY_SIZE_Y/2)))
    #if(defaultPlace[PLACES[i]][2]=='rural') or (defaultPlace[PLACES[i]][2]=='free'):
    place=createPlaceDefault(Point(int(CITY_SIZE_X/2),int(CITY_SIZE_Y/2)),PLACESN[i])
    place.set_name(PLACESN[i])
    buildings.append(place)
    
buildings=generaPlace(buildings,new_town)
buildings=mappa_zone(buildings)

print('Controllo conflitti natura')
for place in list(buildings):
        for n in list(nature):
            if(place.overlaps(n)):
                if(defaultResurce[n.name][1]=='removable'):
                    nature.remove(n)
                else:
                    if(place.name=='HOUSE'):
                        try:
                            buildings.remove(place)
                        except ValueError as e:
                            pass
                    else:
                        print('muovo a nord '+place.name+' di : '+str(n.top-place.top))
                        place.move(1,n.top-place.top)  

for place in list(buildings):
    for place2 in list(buildings):
        if(not (id(place)==id(place2))):
開發者ID:uneekone,項目名稱:fantasy-city-planner,代碼行數:33,代碼來源:fcp.py


注:本文中的rect.Rect.overlaps方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。