Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -157,10 +157,13 @@ def main():
|
|
157 |
current_time = time.time()
|
158 |
for crop_type, plant_times in game_data[player_name]["crops"].items():
|
159 |
for plant_time in plant_times:
|
160 |
-
|
|
|
161 |
st.progress(growth_progress)
|
162 |
-
|
163 |
-
|
|
|
|
|
164 |
with col4:
|
165 |
st.write("Harvest Ready Crops:")
|
166 |
for crop_type in game.crops:
|
|
|
157 |
current_time = time.time()
|
158 |
for crop_type, plant_times in game_data[player_name]["crops"].items():
|
159 |
for plant_time in plant_times:
|
160 |
+
# Convert progress to 0-1 range instead of 0-100
|
161 |
+
growth_progress = min(1.0, (current_time - plant_time) / game.crops[crop_type]["growth_time"])
|
162 |
st.progress(growth_progress)
|
163 |
+
# Display percentage for user (0-100)
|
164 |
+
progress_percent = growth_progress * 100
|
165 |
+
st.write(f"{game.crops[crop_type]['emoji']} {crop_type}: {progress_percent:.1f}% grown")
|
166 |
+
|
167 |
with col4:
|
168 |
st.write("Harvest Ready Crops:")
|
169 |
for crop_type in game.crops:
|