本文整理匯總了Python中rect.Rect.move方法的典型用法代碼示例。如果您正苦於以下問題:Python Rect.move方法的具體用法?Python Rect.move怎麽用?Python Rect.move使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rect.Rect
的用法示例。
在下文中一共展示了Rect.move方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: print
# 需要導入模塊: from rect import Rect [as 別名]
# 或者: from rect.Rect import move [as 別名]
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))):
if(place.overlaps(place2)):
if(place.name=='HOUSE'):
if(place in buildings):
buildings.remove(place)
else:
if(not place2.name=='HOUSE'):
r=random.randint(0,1)
if(r==0):
place.move(0,place.right-place.left+place2.right-place2.left)
if(r==1):
place.move(1,place.bottom-place.top+place2.bottom-place2.top)