I took some insparation from Friday Night Funkin but I want it to be a button-mash so it is more friendly for phone users. Here is my code.
I love some help with a button mash-like mini-game!
Here is a custom_screen's commands
Code: Select all
init python:
def player_pressed():
# Perform actions when the button is pressed
# For example, you can increment a variable or trigger an event
pass # Replace this with your actual action
screen button_mashing_game():
vbox:
# Display the image button for the player to press
imagebutton:
idle "button-idle.png" # Image for the button's idle state
hover "button-idle.png" # Image for the button when hovered (same as idle)
selected "button-lit.png" # Image for the button's pressed state
action Function(player_pressed) # Action when the button is pressed
text "Opponent's Progress:"
bar value game.opponent_progress range (0, 100)
text "Your Progress:"
bar value game.player_progress range (0, 100)
Here is the Mini-Game itself:
Code: Select all
# Define the player_pressed function
init python:
def player_pressed():
# Increase player progress when the button is pressed
game.player_progress += 10 # Adjust the increment as desired
# Opponent's turn
opponent_turn()
# Define opponent's turn logic
init python:
def opponent_turn():
# Determine opponent's progress based on difficulty level
opponent_progress_increment = 5 + game.difficulty * 2 # Adjust difficulty impact as desired
game.opponent_progress += opponent_progress_increment
# Define the start_mini_game label
label start_mini_game:
# Reset progress variables
$ game['player_progress'] = 0
$ game['opponent_progress'] = 0
# Display "Ready?" image
show ready
pause 1.5 # Adjust the pause duration as needed
# Display "Set..." image
show set
pause 1.5 # Adjust the pause duration as needed
# Display "GO!" image
show go
pause 1.5 # Adjust the pause duration as needed
# Show the mini-game screen
show screen button_mashing_game
# Loop until either player wins or exits the mini-game
label game_loop:
if game['player_progress'] >= 100:
# Player wins the mini-game
"You win!"
pause 1 # Pause for readability
jump station2
elif game['opponent_progress'] >= 100:
# Opponent wins the mini-game
"You lose!"
pause 1 # Pause for readability
jump game_over
# Hide the mini-game screen
hide screen button_mashing_game
EDIT: The objective of this code is to symbolize overcoming fear. When you lose, the screen darkens, creating a vignette effect, while winning makes the screen clear again. At the top, there's a progress bar that shifts to the left if you lose and to the right if you win. In the middle, there's a button to press as fast you can!