#๐ Game screen not properly transitioning after minigame - Renpy
10 messages ยท Page 1 of 1 (latest)
@mint vigil
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
screen category_selection:
frame:
background None
align (0.5, 0.5)
has vbox:
spacing 10
text "Select a category:"
textbutton "Math" action [Hide("category_selection"), Jump("math_category")]:
text_color "#000000"
textbutton "Science" action [Hide("category_selection"), Jump("science_category")]:
text_color "#000000"
textbutton "History" action [Hide("category_selection"), Jump("history_category")]:
text_color "#000000"
textbutton "Geography" action [Hide("category_selection"), Jump("geography_category")]:
text_color "#000000"
textbutton "English" action [Hide("category_selection"), Jump("english_category")]:
text_color "#000000"```
init python:
score = {
'player': 0,
'helper': 0
}
def calculate_score(player_answer, helper_answer, correct_answer):
player_score = 0
helper_score = 0
player_correct = (player_answer == correct_answer)
helper_correct = (helper_answer == correct_answer)
if player_correct and helper_correct:
player_score += 2
helper_score += 2
elif player_correct:
player_score += 1
elif helper_correct:
helper_score += 1
return player_score, helper_score
def handle_category(category):
question = get_random_question(category)
renpy.hide_screen("category_selection")
renpy.say(None, f"You selected {category.capitalize()}! Here's your question:")
renpy.say(None, f"{question['question']}")
choice = renpy.display_menu([
(f"Answer 1: {question['answers'][0]}", question['answers'][0]),
(f"Answer 2: {question['answers'][1]}", question['answers'][1]),
(f"Answer 3: {question['answers'][2]}", question['answers'][2]),
(f"Answer 4: {question['answers'][3]}", question['answers'][3])
], cancel='Cancel')
player_answer = choice
helper_answer = get_helper_answer(None, question['answers'])
renpy.say(None, f"You chose: {player_answer}")
renpy.say(None, f"Your helper chose: {helper_answer}")
player_correct = (player_answer == question['correct'])
helper_correct = (helper_answer == question['correct'])
if player_correct:
renpy.say(None, "Your answer is correct!")
else:
renpy.say(None, "Your answer is incorrect.")
if helper_correct:
renpy.say(None, "Your helper's answer is correct!")
else:
renpy.say(None, "Your helper's answer is incorrect.")
player_round_score, helper_round_score = calculate_score(player_answer, helper_answer, question['correct'])
score['player'] += player_round_score
score['helper'] += helper_round_score
renpy.say(None, f"Your score for this round is: {score['player']}")
renpy.say(None, f"Helper's score for this round is: {score['helper']}")
if score['player'] >= 7:
renpy.say(None, "Congratulations, you have won!")
renpy.hide_screen("category_selection")
renpy.show_screen("remember_menu_screen")
return
elif score['helper'] >= 7:
renpy.say(None, "Your helper has won!")
renpy.hide_screen("category_selection")
renpy.show_screen("remember_menu_screen")
return
renpy.call_screen("category_selection")```
label play:
call screen category_selection
python:
question = get_random_question(_return)
correct_answer = question['correct']
answers = list(question['answers'])
random.shuffle(answers)
menu:
"Here's your question: [question['question']]"
"[answers[0]]":
$ player_answer = answers[0]
"[answers[1]]":
$ player_answer = answers[1]
"[answers[2]]":
$ player_answer = answers[2]
"[answers[3]]":
$ player_answer = answers[3]
python:
helper_answer = random.choice(answers)
player_round_score, helper_round_score = calculate_score(player_answer, helper_answer, correct_answer)
score['player'] += player_round_score
score['helper'] += helper_round_score
"Your score for this round is: [score['player']]"
"Helper's score for this round is: [score['helper']]"
if score['player'] >= 7:
"Congratulations, you have won!"
$ renpy.hide_screen("category_selection")
$ renpy.show_screen("remember_menu_screen")
return
elif score['helper'] >= 7:
"Your helper has won!"
$ renpy.hide_screen("category_selection")
$ renpy.show_screen("remember_menu_screen")
return
else:
jump play
label math_category:
python:
handle_category("math")
label science_category:
python:
handle_category("science")
label history_category:
python:
handle_category("history")
label geography_category:
python:
handle_category("geography")
label english_category:
python:
handle_category("english")```
When the game ends after 7 points, it correctly goes back to the menu, but it continues to have overlay of the UI of the minigame
Messaging just so the thread stays open
Sheesh i would love to help you but have no clue how the library works
Good luck on fixing the issue though
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.