|
@@ -93,12 +93,12 @@ class Case(QGraphicsPolygonItem):
|
|
|
self.setZValue(0)
|
|
self.setZValue(0)
|
|
|
self.setFiltersChildEvents(True)
|
|
self.setFiltersChildEvents(True)
|
|
|
|
|
|
|
|
- #pour afficher les coordonnees des cases:
|
|
|
|
|
- #text = QGraphicsSimpleTextItem("{}-{}".format(self.x,self.y), parent=self)
|
|
|
|
|
- #if self.plateau.formeCases == "H":
|
|
|
|
|
- # text.setPos(QPointF(((self.x*0.866)+0.2886)*self.plateau.hCase, self.y*self.plateau.hCase))
|
|
|
|
|
- #else:
|
|
|
|
|
- # text.setPos(QPointF(self.x*self.plateau.hCase, self.y*self.plateau.hCase))
|
|
|
|
|
|
|
+## #pour afficher les coordonnees des cases:
|
|
|
|
|
+## text = QGraphicsSimpleTextItem("{}-{}".format(self.x,self.y), parent=self)
|
|
|
|
|
+## if self.plateau.formeCases == "H":
|
|
|
|
|
+## text.setPos(QPointF(((self.x*0.866)+0.2886)*self.plateau.hCase, self.y*self.plateau.hCase))
|
|
|
|
|
+## else:
|
|
|
|
|
+## text.setPos(QPointF(self.x*self.plateau.hCase, self.y*self.plateau.hCase))
|
|
|
|
|
|
|
|
#polygone utilise lorsque dans champ de deplacement
|
|
#polygone utilise lorsque dans champ de deplacement
|
|
|
self.polygoneChampDep = QGraphicsPolygonItem(self.polygone(self.x, self.y), parent=self)
|
|
self.polygoneChampDep = QGraphicsPolygonItem(self.polygone(self.x, self.y), parent=self)
|
|
@@ -151,7 +151,6 @@ class Case(QGraphicsPolygonItem):
|
|
|
#si x est impair sur un plateau a cases hexagonales, le y est augmente de 0.5
|
|
#si x est impair sur un plateau a cases hexagonales, le y est augmente de 0.5
|
|
|
if 1 == (x % 2):
|
|
if 1 == (x % 2):
|
|
|
y += 0.5
|
|
y += 0.5
|
|
|
-
|
|
|
|
|
polygone << QPointF(((x*0.866)+0.2886)*self.plateau.hCase, y*self.plateau.hCase) \
|
|
polygone << QPointF(((x*0.866)+0.2886)*self.plateau.hCase, y*self.plateau.hCase) \
|
|
|
<< QPointF(((x*0.866)+0.866)*self.plateau.hCase, y*self.plateau.hCase) \
|
|
<< QPointF(((x*0.866)+0.866)*self.plateau.hCase, y*self.plateau.hCase) \
|
|
|
<< QPointF(((x*0.866)+1.1547)*self.plateau.hCase, (y+0.5)*self.plateau.hCase) \
|
|
<< QPointF(((x*0.866)+1.1547)*self.plateau.hCase, (y+0.5)*self.plateau.hCase) \
|
|
@@ -170,7 +169,10 @@ class Case(QGraphicsPolygonItem):
|
|
|
seulement cases existantes sur le plateau / seulement cases adjacentes (cas des cases carrees)"""
|
|
seulement cases existantes sur le plateau / seulement cases adjacentes (cas des cases carrees)"""
|
|
|
voisins = []
|
|
voisins = []
|
|
|
if self.plateau.formeCases == "H":
|
|
if self.plateau.formeCases == "H":
|
|
|
- lst = [(x, y-1), (x+1, y-1), (x+1, y), (x, y+1), (x-1, y), (x-1, y-1)]
|
|
|
|
|
|
|
+ if 1 == (x % 2):
|
|
|
|
|
+ lst = [(x, y-1), (x+1, y), (x+1, y+1), (x, y+1), (x-1, y+1), (x-1, y)]
|
|
|
|
|
+ else:
|
|
|
|
|
+ lst = [(x, y-1), (x+1, y-1), (x+1, y), (x, y+1), (x-1, y), (x-1, y-1)]
|
|
|
else:
|
|
else:
|
|
|
lst = [(x, y-1), (x+1, y-1), (x+1, y), (x+1, y+1), (x, y+1), (x-1, y+1), (x-1, y), (x-1, y-1)]
|
|
lst = [(x, y-1), (x+1, y-1), (x+1, y), (x+1, y+1), (x, y+1), (x-1, y+1), (x-1, y), (x-1, y-1)]
|
|
|
|
|
|