@@ -32,6 +32,7 @@ def loadMap(self):
32
32
33
33
def setupBackground (self ):
34
34
img_index = self .map_data [c .BACKGROUND_TYPE ]
35
+ self .background_type = img_index
35
36
self .background = tool .GFX [c .BACKGROUND_NAME ][img_index ]
36
37
self .bg_rect = self .background .get_rect ()
37
38
@@ -91,7 +92,10 @@ def initPlay(self, card_list):
91
92
self .drag_plant = False
92
93
self .hint_image = None
93
94
self .hint_plant = False
94
- self .produce_sun = True
95
+ if self .background_type == c .BACKGROUND_DAY :
96
+ self .produce_sun = True
97
+ else :
98
+ self .produce_sun = False
95
99
self .sun_timer = self .current_time
96
100
97
101
self .removeMouseImage ()
@@ -136,10 +140,10 @@ def play(self, mouse_pos, mouse_click):
136
140
map_x , map_y = self .map .getRandomMapIndex ()
137
141
x , y = self .map .getMapGridPos (map_x , map_y )
138
142
self .sun_group .add (plant .Sun (x , 0 , x , y ))
139
- if not self .drag_plant and mouse_pos and mouse_click [0 ]:
140
- for sun in self .sun_group :
141
- if sun .checkCollision (mouse_pos [0 ], mouse_pos [1 ]):
142
- self .menubar .increaseSunValue (sun .sun_value )
143
+ if not self .drag_plant and mouse_pos and mouse_click [0 ]:
144
+ for sun in self .sun_group :
145
+ if sun .checkCollision (mouse_pos [0 ], mouse_pos [1 ]):
146
+ self .menubar .increaseSunValue (sun .sun_value )
143
147
144
148
for car in self .cars :
145
149
car .update (self .game_info )
0 commit comments