Skip to content

Commit 39c9819

Browse files
committed
placement dun humain et forum (placement arbitraire a voir)
1 parent bc1abaf commit 39c9819

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

batiment.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@ def __init__(self, position):
1414
self.capacityHuman = 0
1515
self.tourConstruction = 0
1616
self.tourConsructionMax = 24 # arbitraire
17+
18+
def construit(self):
19+
res = False
20+
self.tourConstruction += 1
21+
if (self.tourConstruction > tourConstructionMax):
22+
res = True
23+
return res
1724

18-
def construit(self):
19-
res = False
20-
self.tourConstruction += 1
21-
if (self.tourConstruction > tourConstructionMax):
22-
res = True
23-
return res
24-
25-
def placer(self, sprite, scale):
26-
interface.overviewWidgetGlobal.addItemToScene(sprite, self.position, scale)
27-
iamap.matrixglobal[self.position[0]][self.position[1]].set_have(self)
28-
iamap.matrixglobal[self.position[0]][self.position[1]].set_property(self.typeBatiment())
29-
# je ne sais pas si ca marche correctment typeBatiment()
30-
25+
def placer(self, sprite, scale):
26+
interface.overviewWidgetGlobal.addItemToScene(sprite, self.position, scale)
27+
iamap.matrixglobal[self.position[0]][self.position[1]].set_property(self.typeBatiment())
28+
# je ne sais pas si ca marche correctment typeBatiment()
29+
3130
def peutContenir(self, ressource):
3231
res = False
3332
if (ressource == "food"):
@@ -59,7 +58,7 @@ def sortirRessource(self, aSortir, nombre):
5958
res = -1
6059
return res
6160

62-
def rentrerRessource(self, aRentrer, nombre):
61+
def rentrerRessource(self, aRentrer, nombre):
6362
if (aRentrer == "food"):
6463
res = self.capacityFood - self.fillinFood
6564
if (nombre > res):
@@ -78,7 +77,7 @@ def rentrerRessource(self, aRentrer, nombre):
7877
res = -1
7978
return res
8079

81-
def sortir(self, human):
80+
def sortir(self, human):
8281
if (human.isIn == True):
8382
human.isOut = False
8483
res = 1
@@ -128,7 +127,7 @@ def __init__(self, position):
128127
self.capacityFood = 20 #arbitraire
129128
self.capacityWood = 20 #arbitraire
130129
self.capacityHuman = 10 #arbitraire
131-
self.placer("resources/forum.jpg",0.5) #TODO
130+
self.placer("resources/forum.png",0.4)
132131

133132
def typeBatiment(self):
134133
return 'forum'

iamap.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from perlin import *
22
from Gaia import *
33
from human import *
4+
from batiment import *
45
import manager
56
from manager import *
67
global matrixglobal
@@ -238,6 +239,11 @@ def desHumains(self):
238239
self.matrix[i][j].set_have(human)
239240
manager.managerGlobal.addEtre(human)
240241

242+
def unForum(self):
243+
i = int(self.height/2-1)
244+
j = int(self.width/2-1)
245+
forum = Forum((i,j))
246+
241247
class IAMapCell:
242248

243249
def __init__(self,cell_type):

main.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def main():
2525
iamap.desMoutonsDePartout()
2626
iamap.desLoupsDePartout()
2727
iamap.desHumains()
28+
iamap.unForum()
2829

2930
#print(iamap.A_star((75,75),(150,150)))
3031
# exit quand l'interface s'est coupée (fermeture du programme)

0 commit comments

Comments
 (0)