Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Mazzone <mazzone.diego@gmail.com>2010-12-15 21:54:16 (GMT)
committer Diego Mazzone <mazzone.diego@gmail.com>2010-12-15 21:54:16 (GMT)
commit830190a30e1a73f6214912a68c0e23336e547b89 (patch)
tree1b634656942de7a0203587ef4487d7d5b0c7bb49
parent2ad876092db2adf7de3747a40d5b6fa92a97333f (diff)
Changes on challenges.
Dispatch challenge according to the lowest bar. GUI with problems [large questions]. I'll fix it on next commit using TextBlocks instead of Text.
-rwxr-xr-xSaludame.activity/challenges.py4
-rwxr-xr-xSaludame.activity/challenges_creator.py46
-rwxr-xr-xSaludame.activity/game_manager.py3
-rwxr-xr-xSaludame.activity/status_bars.py8
-rwxr-xr-xSaludame.activity/windows_controller.py4
5 files changed, 53 insertions, 12 deletions
diff --git a/Saludame.activity/challenges.py b/Saludame.activity/challenges.py
index bdabe41..7e8d0c2 100755
--- a/Saludame.activity/challenges.py
+++ b/Saludame.activity/challenges.py
@@ -79,8 +79,8 @@ class MultipleChoice(Window):
cual muchas veces "corta" a una palabra en cualquier lado.
"""
if (self.question.rect_in_container.width > self.rect.width - 20):
- q1 = Text(self.rect, 30, 30, 1, question[:43], TITLE_FONT_SIZE, (0, 255, 0))
- q2 = Text(self.rect, 30, 65, 1, question[43:], TITLE_FONT_SIZE, (0, 255, 0))
+ q1 = Text(self.rect, 30, 30, 1, question[:43], TITLE_FONT_SIZE, (0, 0, 0))
+ q2 = Text(self.rect, 30, 65, 1, question[43:], TITLE_FONT_SIZE, (0, 0, 0))
self.add_child(q1)
self.add_child(q2)
self.question_lines = 2
diff --git a/Saludame.activity/challenges_creator.py b/Saludame.activity/challenges_creator.py
index bfdc2e8..a04a81e 100755
--- a/Saludame.activity/challenges_creator.py
+++ b/Saludame.activity/challenges_creator.py
@@ -7,7 +7,7 @@ from gettext import gettext as _
class ChallengesCreator:
- def __init__(self, container, rect, frame_rate, windows_controller, bg_color=(0, 0, 0)):
+ def __init__(self, container, rect, frame_rate, windows_controller, game_man, bg_color=(0, 0, 0)):
# Windows attributes
self.container = container
@@ -15,6 +15,8 @@ class ChallengesCreator:
self.frame_rate = frame_rate
self.windows_controller = windows_controller
self.bg_color = bg_color
+
+ self.game_man = game_man
# Multiple Choice window
self.challenge = challenges.MultipleChoice(self.container, self.rect, self.frame_rate, self.windows_controller, self, self.bg_color)
@@ -24,7 +26,10 @@ class ChallengesCreator:
self.mc_challenges = []
# Tuples of tf_challenges
- self.tf_challenges = []
+ self.tf_challenges_physica = []
+ self.tf_challenges_hygiene = []
+ self.tf_challenges_nutrition = []
+ self.tf_challenges_spare_time = []
def create_challenges(self):
# Common multiple choice
@@ -35,9 +40,21 @@ class ChallengesCreator:
# True or false
# 0 = False | 1 = True
- self._create_tf_challenge(_("The 70% of the body is made up of water"), 1, 10, 10)
- self._create_tf_challenge(_("Breakfast is the most important meal of the day"), 1, 10, 10)
- self._create_tf_challenge(_("Children should exercise once a month"), 0, 10, 10)
+ self.tf_challenges_physica.append(self._create_tf_challenge(_("La alimentación adecuada previene muchas enfermedades importantes"), 1, 10, 10))
+ self.tf_challenges_physica.append(self._create_tf_challenge(_("Si no nos vacunamos con las vacunas obligatorias podemos enfermarnos"), 1, 10, 10))
+ self.tf_challenges_physica.append(self._create_tf_challenge(_("Cuando estamos ingiriendo alimentos en menor proporción a lo que necesitamos, podemos volvernos más susceptibles a las infecciones "), 1, 10, 10))
+
+ self.tf_challenges_hygiene.append(self._create_tf_challenge(_("Muchos alimentos pueden estar contaminados con agroquímicos, y pesticidas porque son frecuentemente usados"), 1, 10, 10))
+ self.tf_challenges_hygiene.append(self._create_tf_challenge(_("Si no voy a comer no necesito lavarme las manos "), 0, 10, 10))
+ self.tf_challenges_hygiene.append(self._create_tf_challenge(_("Lo primero que hay que hay que hacer cuando vamos a lavarnos las manos es ponernos jabón"), 0, 10, 10))
+
+ self.tf_challenges_nutrition.append(self._create_tf_challenge(_("Cuando aprendemos hábitos saludables estamos cuidando nuestra salud"), 1, 10, 10))
+ self.tf_challenges_nutrition.append(self._create_tf_challenge(_("Tomar mucha agua, hacer ejercicio y comer frutas y verduras ayuda a mover el intestino sin dificultad"), 1, 10, 10))
+ self.tf_challenges_nutrition.append(self._create_tf_challenge(_("El desayuno no es importante en nuestra alimentación"), 0, 10, 10))
+
+ self.tf_challenges_spare_time.append(self._create_tf_challenge(_("La actividad física mejora nuestra imagen"), 1, 10, 10))
+ self.tf_challenges_spare_time.append(self._create_tf_challenge(_("La actividad física no nos ayuda prevenir enfermedades como el sobrepeso y la obesidad "), 0, 10, 10))
+ self.tf_challenges_spare_time.append(self._create_tf_challenge(_("Ser sedentarios no tiene importancia y no afecta nuestra salud"), 0, 10, 10))
def _create_mc_challenge(self, question, answers, correct_answer, win_points, lose_points, image=None):
"""
@@ -51,7 +68,7 @@ class ChallengesCreator:
Create a new tf_challenge (tuple)
"""
challenge = (question, ["False", "True"], correct_answer, win_points, lose_points, image)
- self.tf_challenges.append(challenge)
+ return challenge
def get_challenge(self, kind):
"""
@@ -62,9 +79,22 @@ class ChallengesCreator:
r = random.randrange(0, len(self.mc_challenges))
c = self.mc_challenges[r]
elif kind == "tf":
+
self.challenge.kind = "tf"
- r = random.randrange(0, len(self.tf_challenges))
- c = self.tf_challenges[r]
+
+ bar = self.game_man.get_lowest_bar()
+ if bar.id == "physica":
+ r = random.randrange(0, len(self.tf_challenges_physica))
+ c = self.tf_challenges_physica[r]
+ elif bar.id == "hygiene":
+ r = random.randrange(0, len(self.tf_challenges_hygiene))
+ c = self.tf_challenges_hygiene[r]
+ elif bar.id == "nutrition":
+ r = random.randrange(0, len(self.tf_challenges_nutrition))
+ c = self.tf_challenges_nutrition[r]
+ elif bar.id == "spare_time":
+ r = random.randrange(0, len(self.tf_challenges_spare_time))
+ c = self.tf_challenges_spare_time[r]
# Set multiple choice attributes
self.challenge.set_question(c[0])
diff --git a/Saludame.activity/game_manager.py b/Saludame.activity/game_manager.py
index 162af26..def606a 100755
--- a/Saludame.activity/game_manager.py
+++ b/Saludame.activity/game_manager.py
@@ -252,6 +252,9 @@ class GameManager:
for action in self.actions_list:
if(action.id == action_id):
return action
+
+ def get_lowest_bar(self):
+ return self.bars_controller.get_lowest_bar()
def __control_active_actions(self):
"""
diff --git a/Saludame.activity/status_bars.py b/Saludame.activity/status_bars.py
index 000fcd2..5d69fcd 100755
--- a/Saludame.activity/status_bars.py
+++ b/Saludame.activity/status_bars.py
@@ -408,6 +408,14 @@ class BarsController:
for bar in self.bars:
bar.value = bars_values[bar.id]
+ def get_lowest_bar(self):
+ value = self.bars[0].value
+ lowest_bar = None
+ for bar in self.bars[0:4]: # bars in second_level (section bars) are self.bars[0:4]
+ if bar.value <= value:
+ value = bar.value
+ lowest_bar = bar
+ return lowest_bar
class StatusBar:
"""
diff --git a/Saludame.activity/windows_controller.py b/Saludame.activity/windows_controller.py
index e0dec33..ecee1fd 100755
--- a/Saludame.activity/windows_controller.py
+++ b/Saludame.activity/windows_controller.py
@@ -41,11 +41,11 @@ class WindowsController:
Creates windows and set the main_window as active window
"""
# Challenges
- cha_creator = challenges_creator.ChallengesCreator(self.screen.get_rect(), pygame.Rect((250, 30), (934, 567)), 1, self, (40, 40, 200))
+ cha_creator = challenges_creator.ChallengesCreator(self.screen.get_rect(), pygame.Rect((250, 30), (934, 567)), 1, self, self.game_man, (40, 40, 200))
cha_creator.create_challenges()
self.game_man.challenges_creator = cha_creator
- info_master_challenge = challenges.InfoMasterChallenge(self.screen.get_rect(), pygame.Rect((250, 30), (934, 567)), 1, self, cha_creator, "¡Felicitaciones! \nHas completado el nivel actual. Para pasar de nivel \ndebes contestar bien la siguiente pregunta. \n\n¡¡Suerte!!", "Felicitaciones, has pasado de nivel. \nSe han desbloqueado nuevas acciones, \n¿te animás a encontrarlas?", "Contestaste incorrectamente, \ntendrás que intentar pasar de nivel más adelante")
+ info_master_challenge = challenges.InfoMasterChallenge(self.screen.get_rect(), pygame.Rect((250, 30), (934, 567)), 1, self, cha_creator, u"¡Felicitaciones! \nHas completado el nivel actual. Para pasar de nivel \ndebes contestar bien la siguiente pregunta. \n\n¡¡Suerte!!", u"Felicitaciones, has pasado de nivel. \nSe han desbloqueado nuevas acciones, \n¿te animás a encontrarlas?", u"Contestaste incorrectamente, \ntendrás que intentar pasar de nivel más adelante")
# Customization Window
customization_window = customization.CustomizationWindow(self.screen.get_rect(), pygame.Rect((250, 30), (934, 567)), 1, self, app_loader.get_character())