awacke1 commited on
Commit
b430856
β€’
1 Parent(s): 73d2460

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +83 -0
app.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import random
3
+
4
+ # Define a function to roll dice and return a random emoji based on the result
5
+ def roll_dice():
6
+ result = random.randint(1, 6)
7
+ dice_emojis = ['βš€', '⚁', 'βš‚', 'βšƒ', 'βš„', 'βš…']
8
+ return dice_emojis[result - 1]
9
+
10
+ # Function to handle character creation
11
+ def create_character():
12
+ with st.form("Character Creation"):
13
+ name = st.text_input("Character Name")
14
+ trait = st.selectbox("Select a Trait", ["Brave", "Clever", "Kind"])
15
+ desire = st.text_input("What is your character's desire?")
16
+ submitted = st.form_submit_button("Create Character")
17
+ if submitted:
18
+ st.session_state.character = {'name': name, 'trait': trait, 'desire': desire}
19
+ st.success(f"Character {name} created successfully!")
20
+
21
+ # Function to start the quest
22
+ def start_quest():
23
+ st.markdown("## πŸš€ The Quest Begins")
24
+ st.write("You embark on your journey to find the carousel. Along the way, you encounter various challenges.")
25
+ challenge = st.button("Face a Challenge")
26
+ if challenge:
27
+ st.write(f"You faced a challenge and your path changes. Roll a dice to see the outcome.")
28
+ dice_result = roll_dice()
29
+ st.write(f"Dice Roll Result: {dice_result}")
30
+ # Update the path based on the dice roll if needed
31
+ # This is where you can add logic to alter the player's path or story based on the dice roll.
32
+
33
+ # Function to encounter the carousel
34
+ def carousel_encounter():
35
+ st.markdown("## 🎠 Carousel Encounter")
36
+ st.write("You've found the carousel! It's time to experience its magic.")
37
+ ride = st.button("Ride the Carousel")
38
+ if ride:
39
+ st.write("The carousel starts spinning and you're engulfed in a whirlwind of colors and sounds.")
40
+ # This is where you can add logic for the carousel encounter outcomes.
41
+
42
+ # Function to display the climactic choices and resolution
43
+ def climactic_choices():
44
+ st.markdown("## βš–οΈ Climactic Choices")
45
+ choice = st.radio("What choice will you make?", ["Embrace the change", "Resist the change"])
46
+ if st.button("Make Choice"):
47
+ if choice == "Embrace the change":
48
+ st.markdown("## πŸ¦‹ Resolution and Transformation")
49
+ st.write("Your choice leads to a beautiful transformation of the world and yourself.")
50
+ else:
51
+ st.markdown("## πŸ¦‹ Resolution and Transformation")
52
+ st.write("Resisting the change keeps the world as it was, but you wonder what could have been.")
53
+
54
+ # Main app function
55
+ def main():
56
+ st.title("πŸ“– The Carousel Paper Cutout World Adventure")
57
+
58
+ # Initialize session state variables if not already present
59
+ if 'character' not in st.session_state:
60
+ st.session_state.character = None
61
+
62
+ # Display the story outline
63
+ with st.expander("Story Outline and Rules"):
64
+ st.markdown("""
65
+ ### πŸ“– Story Outline: The Carousel Paper Cutout World
66
+ - **Objective:** To create a captivating graphic novel set in a magical paper cutout world.
67
+ - **Theme:** Cycles, changes, and the impact of choices.
68
+ - **Setting:** A vibrant paper cutout world with a central carousel.
69
+ """)
70
+
71
+ # Character creation step
72
+ if st.session_state.character is None:
73
+ create_character()
74
+ else:
75
+ st.write(f"Welcome, {st.session_state.character['name']}!")
76
+
77
+ # Game steps
78
+ start_quest()
79
+ carousel_encounter()
80
+ climactic_choices()
81
+
82
+ if __name__ == "__main__":
83
+ main()