Category: Uncategorized

  • Planetary Exploration Project

    Hello this is my fusion blog post for my Planetery Exploration project prep 1

    • What planet did you choose and why?

    We chose the planet Teegarden’s Star B because this exoplanet scored a 0.9 on the ESI scale(Earth simillarity Index). For comparison, other deemed habitable planets like Proxima Centauri b scored 0.87. This exoplanet sits in the habitable zone around a red dwarf star and has an average surface temperature of 28 °C.

    • What opportunities present themselves on your new home planet?
    1. Teegarden’s Star B sits in the goldilocks zone where liquid water could exist if there is a suitable atmoshphere. As a result, astronomers estimate the chance of water existing on the exoplanet to be 60%.
    2. Teegarden’s Star B has a minimum mass close to earths, this suggest the exoplanet is rocky. This is an exciting oppouruinity because rocky planets have enough gravity to hold on atmosphere which is vital for: retaining heat, protecting surface water from evaporation, and protection from harmful radiation.
    • What challenges do you foresee?

    Teegarden’s star B is a red dwarf. One uncertainty that scientists have not confirmed is weather not it really has an atmosphere. Sceintists estimate the odds of it having an atmoshphere are a mere 3% chance. Thus, if we are going to be living on this planet we would most likely have to construct an atmosophere of our own which is incredibly dificult.

    Furthermore, Teegarden’s star B is a red dwarf meaning that there are going to be flares which can release dangerous UV Radiation. The planet is considered to be quiter compared to other red dwarf but the risk is still there.

    Teegarden’s Star B also has a very short orbit of about 4.9 earth days. This suggests that the planet is Tidal locked meaning that one side of the planet is alwasy facing towards it’s star. As a result, this max habitabillity more complicated becasue there will be a vast day and night temperature contrast.

    • What implications might there be for vehicle design?

    Teegarden’s Star B has a rocky terrain and gravity similar to Earth. A good implication for vehicle design might be a rocky bogie because it has the ability to traverse through rocky and bumpy environments. Another good implication is the ability to hover for short periods of time. This would allow the vehicle to cross cliffs, deep cracks, or even boulders. And because its gravity is similar to Earth’s, its design can be based on things like planes or helicopters that already exist on Earth, so we don’t need to adjust anything for this implication.

    Because Teegarden is a red dwarf, it releases UV radiation, so we need our vehicle to defend against it. We could implement a reflective outer layer of aluminum foil or polished aluminum, which is widely used as a coating for spacecraft. A second layer of polycarbonate could absorb most of the UV. It would also be safer if the vehicle is remote-controllable, as this would reduce the risk of a human being harmed.

    • How do we know what we know about your planet?  Be specific.  What research was done?  What devices were used?  How did those devices collect what data, and what conclusions can be drawn from them?  What report speaks specifically to this information?

    Scientists first discovered it in 2019 by scientists using the CARMENES spectrograph at the Calar Alto Observatory. CARMENES Spectograph is a powerful instrument that measures the radial velocity of nearby stars. It does this by carefully analyzing changes in the star’s light spectrum. Using this, researchers discovered two planets, one of them being Teegarden’s star b. 

    The data collected in the research included the star’s motion speed, brightness, and wavelength shifts. This allowed scientists to calculate the planet’s mass, orbital period (4.9 days), and distance from its star

    The findings were published in the scientific report:

    Zechmeister et al., “The CARMENES search for exoplanets around M dwarfs: Two temperate Earth-mass planets around Teegarden’s Star,” Astronomy & Astrophysics, 2019.

    SOURCES

    Boukrouche, R., Caballero, R., & Lewis, N. T. (2025, October 24). Near the Runaway: The Climate and Habitability of Teegarden’s Star b. Iopscience. Retrieved November 6, 2025, from https://iopscience.iop.org/article/10.3847/2041-8213/ae122a

    Ward, C. (2024, August 22). Where We Would Send The Ark: The Best Exoplanets Within 25 Light-Years. SYFY. Retrieved November 7, 2025, from https://www.syfy.com/syfy-wire/the-best-exoplanets-within-25-light-years

    Zechmeister, M., Dreizler, S., & Ribas, I. (2019, July 1). The CARMENES search for exoplanets around M dwarfs. EDP Science. Retrieved November 7, 2025, from https://www.aanda.org/articles/aa/full_html/2019/07/aa35460-19/aa35460-19.html

    AI TRANSCRIPTS

    https://docs.google.com/document/d/1fO7wBZ8hILxgQ5XcccFL3p2opJAZwj7fYFEViBcQ9Gk/edit?tab=t.0

  • My Robotics Project

    Hello, for this robotics project, I designed a bomb defusual game using arduino. In the game, the player must defuse the bomb by completing multiple tasks. Currently in the game there are two tasks:

    1. A line of code will display on the LCD screen and the player will have to memorize the code and type it out using the keypad. If they type in the correct code it will display “Code Correct!” on the LCD screen, if not it will display “Code Wrong!” and the bomb will blow up making the player restart.

    2. There is a potentiometer on the breadboard. The player will need to turn the potentiometer left or right to adjust the resistance. The code will generate a random number and the player will have to tune the resistance to that number. (Number ranges from 0-1023)

    VIRTUAL PROTOTYPE

    This virtual prototype was designed using Tinkercad.

    Circut Schematic

    Arduino Uno

    COMPONENTARDUINO PINS
    LCD (I2C)SDA –> A4, SCL–> A5
    KEYPADD2-D9
    POTENTIOMETERA0
    POWER5V, GND –> negative positive rows on breadboard

    The Arduino Uno acts like our brain. It reads all of our inputs, runs our code, and controls all the outputs. We can think of the Arduino uno as the logic board for our bomb. In my circut the Arduino does many things. For example it checks:

    1. What number the player enters on tke keypad

    2. What voltage is coming from the potentiometer

    3. Has the timer run out yet

    it also handles:

    1. Generating the random code and targeted values
    2. Displaying messages on the LCD screen
    3. Comparing player code input with correct value

    Keypad (4×4)

    KEYPAD PINARDUINO PIN
    R19
    R28
    R37
    R46
    C15
    C24
    C33
    C42

    The keypad has 4 rows and 4 columns. When you press a button on the keypad it connects all 4 rows and columns. The arduino sets all columns pins to a high voltage (5V) and the rows are set to input pins (Input pins have no voltage in).

    We can look at the keypad like this:

    C1C2C3C4
    R1123A
    R2456B
    R3789C
    R4*0#D

    EX. If we press 9 on the keypad it connects C3 with R3. The arduino will scan through set each column to a low voltage like 1V. Because the collums and rows are connected it will also give a small voltage to each row. The arduino will scan through all the rows to check for voltage until it finds a row that has voltage and then it will know what buttons is pressed.

    Potentiometer

    NAMEFUNCTIONCONNECTION
    GNDGroundGND
    WIPERSignal outputA0
    VCCPower input5V

    The potentiometer gives a resistance value betwen 0-1023 the arduino reads that and generates a random number between that which the user will have to match.

    LCD I2C

    LCD PINARDUINO PINFUNCTION
    VCC5VPower
    GNDGNDGround
    SDAA4Data line (Transfer data between LCD and Arduino)
    SCLA5Serial clock line (a timer for arduino and LCD to transfer information)

    The LCD I2C acts as our display screen for our game. It will display the code the player needs to memorize, the potentiometer tuning, and other messages.

    MICRO SERVO

    SERVO PINARDUINO PINFUNCTION
    POWER5VPower source
    GROUNDGNDGround
    SIGNALD11Transfer data between the servo and the arduino

    When we suceed in defusing the bomb the servo will move from 0-180 and back like its giving a victory wave. However, when we failt at defusing the bomb the sevo will go from 0-90-0-90 and it will do this 3 times like a head shake saying no.

    Bill of Materials (BOM)

    COMPONENETAMOUNT
    Arduino Uno1
    LCD I2C1
    Keypad 4×41
    Potentiometer1
    Jumper Wires17
    Breadboard1

    CODE

    HERE

    // — 1. Include Libraries —

    include

    include

    include // For servo motor

    // — 2. Hardware & Pin Definitions —

    // — Keypad Setup —
    const byte ROWS = 4;
    const byte COLS = 4;
    char keys[ROWS][COLS] = {
    {‘1’, ‘2’, ‘3’, ‘A’},
    {‘4’, ‘5’, ‘6’, ‘B’},
    {‘7’, ‘8’, ‘9’, ‘C’},
    {‘*’, ‘0’, ‘#’, ‘D’}
    };
    byte rowPins[ROWS] = {9, 8, 7, 6};
    byte colPins[COLS] = {5, 4, 3, 2};
    Keypad customKeypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

    // — LCD Setup —
    LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2);

    // — Servo Setup —
    const int servoPin = 11;
    Servo gameServo;

    // — Component Pin Setup —
    const int potPin = A0;
    const int buttonPin = 10;
    const int randomPin = A1;

    // Keys array for Task 3
    char allKeys[16] = {
    ‘1’, ‘2’, ‘3’, ‘A’, ‘4’, ‘5’, ‘6’, ‘B’,
    ‘7’, ‘8’, ‘9’, ‘C’, ‘*’, ‘0’, ‘#’, ‘D’
    };

    // — Functons for Servo Movement —
    void celebrateWin() {
    for (int pos = 0; pos <= 180; pos += 5) { gameServo.write(pos); delay(15); } for (int pos = 180; pos >= 0; pos -= 5) {
    gameServo.write(pos);
    delay(15);
    }
    }

    void failShake() {
    for (int i = 0; i < 3; i++) {
    gameServo.write(0);
    delay(100);
    gameServo.write(90);
    delay(100);
    }
    }
    // # SETUP
    void setup() {
    lcd.init();
    lcd.backlight();
    pinMode(buttonPin, INPUT_PULLUP);
    randomSeed(analogRead(randomPin*micros()));
    gameServo.attach(servoPin); // Initialize the servo
    }

    // # LOOP
    void loop() {
    // — Wait for Game to Start —
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(“Press to Start”);
    while (digitalRead(buttonPin) == HIGH);

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(“Game Started!”);
    delay(1000);

    // — Task 1: Code Defusal —
    String secretCode = “”;
    for (int i = 0; i < 4; i++) {
    secretCode = secretCode + allKeys[random(0, 16)];
    }

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(“Memorize Code:”);
    lcd.setCursor(0, 1);
    lcd.print(secretCode);
    delay(3000);

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(“Enter Code:”);
    lcd.setCursor(0, 1);

    String playerGuess = “”;
    for (int i = 0; i < 4; i++) {
    char key;
    do {
    key = customKeypad.getKey();
    } while (key == NO_KEY);
    playerGuess = playerGuess + key;
    lcd.print(key);
    }
    delay(500);

    if (playerGuess == secretCode) {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(“Code Correct!”);
    delay(2000);

        // — 3. Task 2: Potentiometer Tune —

        int potTarget = random(0, 1024); // New random target (0-1023)

        lcd.clear();

        lcd.setCursor(0, 0);

        lcd.print(“Target: “);

        lcd.print(potTarget);

        lcd.setCursor(0, 1);

        lcd.print(“Current: “);

        int currentValue = analogRead(potPin);

        // Loop as long as the value is NOT the target

        while (currentValue != potTarget) {

          lcd.setCursor(9, 1);     // Go to “Current: [ ]”

          lcd.print(”    “);      // Clear old number with 4 spaces

          lcd.setCursor(9, 1);     // Go back

          lcd.print(currentValue); // Print new number

          currentValue = analogRead(potPin); // Read again

          delay(50); // Small delay to prevent screen flicker

        }

        // — TASK 2 SUCCEEDED —

        // (The loop ended, so they must have hit the target)

        lcd.clear();

        lcd.setCursor(0, 0);

        lcd.print(“Module Complete!”);

        delay(2000);

        // — 4. Task 3: 5-Char Memorize —

        String secretWord = “”;

        for (int i = 0; i < 5; i++) {

          // Pick a random index (0-15) from our allKeys array

          secretWord = secretWord + allKeys[random(0, 16)];

        }

        lcd.clear();

        lcd.setCursor(0, 0);

        lcd.print(“Memorize This:”);

        lcd.setCursor(0, 1);

        lcd.print(secretWord);

        delay(5000); // Player has 5 seconds

        lcd.clear();

        lcd.setCursor(0, 0);

        lcd.print(“Enter Code:”);

        lcd.setCursor(0, 1);

        String playerWordGuess = “”;

        for (int i = 0; i < 5; i++) {

          char key;

          do {

            key = customKeypad.getKey();

          } while (key == NO_KEY);

          playerWordGuess = playerWordGuess + key;

          lcd.print(key);

        }

        delay(500);

        // — CHECK TASK 3 (FINAL CHECK) —

        if (playerWordGuess == secretWord) {

          // — GAME WON —

          lcd.clear();

          lcd.setCursor(0, 0);

          lcd.print(“BOMB DEFUSED!”);

          lcd.setCursor(0, 1);

          lcd.print(“>> YOU WIN! <<“);

          while (true); // Freeze on win screen

        } else {

          // — TASK 3 FAILED —

          lcd.clear();

          lcd.setCursor(0, 0);

          lcd.print(“Code FAILED!”);

          lcd.setCursor(0, 1);

          lcd.print(“Restarting…”);

          delay(2000);

    } else {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(“Code FAILED!”);
    lcd.setCursor(0, 1);
    lcd.print(“Restarting…”);
    failShake(); // Servo fail
    delay(2000);
    }
    }

    EXPLANATION VIDEO

    Demonstration of Physical Prototype

    In my virtual simulation in Tinkercad, it was near impossible to complete the tunning module because Tinkercad only has a certain amount of numbers the potentiometer can tune to. However my code randomly generates any number between 0-1023. As a result the odds of my code genrating a number that was exacly one of the numbers tinkercad has is very low making it very difficult to pass to the third module. However in my real physical prototype the physical potentiometer doesn’t have this limitation as a result I am basically able to tune to any number within 0-1023 making this module possible.

    Reflections on use of AI

    In my project I the only part where I used AI was for writing my code. This is becaue i’ve alrady been doing robotics with arduino for a good amount of time so I knew wiring was not the biggest problem but coding was.

    I followed a process of :

    Asking guidance for coding with the help of gemeni

    Asking for help to fix erros I had in my code

    This worked really well for me. A quick AI explanation of something helped me learn alot quicker then having to search up things online or watching tutorial videos. AI also asked me alot of questions which helped me strenghten my learning.

    Here is a transcript of my interaction with gemeni

    https://docs.google.com/document/d/1wm8IMkZhEzdcZkRg9x4BjzSsVK3zBpEwu0W_judVOek/edit?tab=t.0lcd.clear_screen?

  • My CAD Project

    Hello, for this CAD assignment, I designed a skateboard to demonstrate my understanding of several CAD skills including, sketching, extruding, assemby, mechanical drawings, and creating a BOM. Here is my CAD project using Onshape:

    https://sgs.onshape.com/documents/95442c9d34f6285defe7d03f/w/9459497afed782aec5d7288b/e/4056898ab201b65c19ca6996

    SKETCH

    I started by sketching the skateboard deck using the sketch tool. I drew a long rectangle and another two rectangles on each side. I used the construction tool to find the centre of my two additional rectangles and drew a line through that to find a middle point. I then created a half circle on that line.

    Furthermore, I also sketched out the trucks in a seperate part studio and the wheels aswell.

    EXTRUDE

    Once my sketches were all complete, I first used to extrude tool to make my deck have curved edges. I was able to do this by slecting the parts that were not within the half circile and removing them with the extreude tool. I then extruded both the wheels and the truck.

    ASSEMBLY

    Next, I went into the assembly studiom to combine all my parts. I attached the trucks and wheels to the bottom of the deck using align and mate tools. I used the revolute tool to make sure that all my wheels were centered and attached to the truck. Finally this made the skateboard look like a real object that could actually roll.

    MECHANICAL DRAWINGS

    After completing the model, I created a mechanical drawing that includes:

    • Top view with full board dimensions
    • Side and front views showing wheel placement and angles
    • An Isometric view to show how the whole skateboard looks assembled

    All relevant dimensions, such as the: deck lenght, deck thickness, wheel width, etc.. are clearly labeled. You can see these in my drawing below.

    BILL OF MATERIALS (BOM)

    I also included a bill of meaterial in my drawing. The BOM lists all the components used:

    ITEM QUANTITYPART NUMBERDESCRIPTION
    11Board 1black paint on top
    214 sets of wheels

    This table helps identify what parts are needed to fabricate or 3D print the skateboard. For the wheels you will only need to print it once as it has 4 wheels in the part’s studio. You can also choose to paint the top of you skateboard black to better identity which side is the top or bottom.

  • My Coding project

    Hello everyone!

    This is the first game I have created in fusion and the game I have made is a choose your own adventure strog game, with the help of google gemeni!

    Here is the link trasncript between me and google gemeni

    https://docs.google.com/document/d/1zMuhdl62tHDXEHV2VbSNrdfIlPDcpH-hKM0a0BT6Ubc/edit?tab=t.0

    This is my flowchart and my process of ideas on how I wanted to make my game and how the user would “win” the game

    Below is the code that I used to create my game. However, you do need to instal a libary called tkinter or else it will not work. For some people they are unable to do that. Thus I have recorded a yotube video that will go over my code and game. Here is the video.

    Here is my code

    CODE

    import tkinter as tk

    # Player inventory, accessible by all functions.
    inventory = {
    “gold”: 0,
    “sword”: False,
    “biscuit”: False,
    “strange_key”: False
    }

    def clear_screen():
    for widget in root.winfo_children():
    widget.destroy()

    # — Functions for Game Choices —

    def fight_the_bear():
    clear_screen()

    if inventory[“sword”] == True:
    story_text = “You draw the sharp sword you found in the chest and kill the bear good job”

    continue_button = tk.Button(root, text=”Search the Cave”, command=bear_cave_chest)
    continue_button.pack()
    else:
    story_text = “You try fighting the bear with your fists?? wow no surpise you get clapped and died L noob.”

    story_label = tk.Label(root, text=story_text)
    story_label.pack()

    play_again_button = tk.Button(root, text=”Play Again”, command=start_game)
    play_again_button.pack()

    def bear_cave_chest():

    clear_screen()
    inventory[“strange_key”] = True
    story_label = tk.Label(root, text=”Deeper in the cave, you find the bear’s treasure chest. Inside is a strange key.”)
    story_label.pack()


    back_button = tk.Button(root, text=”Take key and go back”, command=start_game)
    back_button.pack()

    def hide_from_bear():
    clear_screen()

    if inventory[“biscuit”] == True:
    story_text = “you hide and live off the biscut. a hunter comes and saves you, you win!”
    else:
    story_text = “You hide but you died of starvation, L noob”

    story_label = tk.Label(root, text=story_text)
    story_label.pack()

    play_again_button = tk.Button(root, text=”Play Again”, command=start_game)
    play_again_button.pack()

    def wolf_attack():
    clear_screen()
    story_label = tk.Label(root, text=”You hear some howls, you get surrounded by wolves and you died L noob.”)
    story_label.pack()
    play_again_button = tk.Button(root, text=”Play Again”, command=start_game)
    play_again_button.pack()

    def meet_bear():
    clear_screen()
    story_label = tk.Label(root, text=”You see a big brown bear.”)
    story_label.pack()
    fight_button = tk.Button(root, text=”Fight the bear”, command=fight_the_bear)
    fight_button.pack()
    hide_button = tk.Button(root, text=”Try to hide”, command=hide_from_bear)
    hide_button.pack()

    def deeper_in_cave():
    clear_screen()
    story_label = tk.Label(root, text=”The cave is damp and you hear a strange noise.”)
    story_label.pack()
    continue_button = tk.Button(root, text=”Follow the noise”, command=meet_bear)
    continue_button.pack()

    def go_in_spooky_cave():
    clear_screen()
    story_label = tk.Label(root, text=”You step into the spooky cave…”)
    story_label.pack()
    continue_button = tk.Button(root, text=”Continue”, command=deeper_in_cave)
    continue_button.pack()

    def leave_spooky_cave():
    clear_screen()
    story_label = tk.Label(root, text=”You decide not to risk it and leave.”)
    story_label.pack()
    continue_button = tk.Button(root, text=”You walk for some time…”, command=wolf_attack)
    continue_button.pack()

    def find_spooky_cave():
    clear_screen()
    story_text = “It’s getting dark, luckily you find a spooky suspicious evil looking cave.”
    story_label = tk.Label(root, text=story_text)
    story_label.pack()
    in_button = tk.Button(root, text=”Go in”, command=go_in_spooky_cave)
    in_button.pack()
    leave_button = tk.Button(root, text=”Leave”, command=leave_spooky_cave)
    leave_button.pack()

    def open_chest():
    global inventory
    clear_screen()
    inventory[“gold”] += 1
    inventory[“sword”] = True
    story_text = f”You open the chest and find a sharp sword and 1 gold piece!\n(Gold: {inventory[‘gold’]})”
    story_label = tk.Label(root, text=story_text)
    story_label.pack()
    back_button = tk.Button(root, text=”Go Back”, command=start_game)
    back_button.pack()

    def try_door():
    clear_screen()

    if inventory[“strange_key”] == True:
    # WINNER: The player has the key
    story_text = “You place the sdFSDFDF0101 F key sdFsda0101fS in”
    story_label = tk.Label(root, text=story_text)
    story_label.pack()
    story_text = “you’ve escaped the matrix! … or have U?”
    story_label = tk.Label(root, text=story_text)
    story_label.pack()

    continue_button = tk.Button(root, text=”Continue”, command=show_credits)
    continue_button.pack()

    else:
    story_label = tk.Label(root, text=”The key doesn’t fit the door. It remains locked.”)
    story_label.pack()
    back_button = tk.Button(root, text=”Go Back”, command=go_left)
    back_button.pack()

    def live():
    global inventory
    clear_screen()
    inventory[“gold”] -= 1
    inventory[“biscuit”] = True
    story_text = f”You trade 1 gold for the biscuit.\n(Gold: {inventory[‘gold’]})”
    story_label = tk.Label(root, text=story_text)
    story_label.pack()
    back_button = tk.Button(root, text=”Go Back”, command=start_game)
    back_button.pack()

    def show_credits():
    clear_screen()
    story_label = tk.Label(root, text=”Game Created By Tiger wei and thanks to gemeni!\n\nThanks for playing.”)
    story_label.pack()

    play_again_button = tk.Button(root, text=”Play Again”, command=start_game)
    play_again_button.pack()

    def go_away():
    clear_screen()
    story_label = tk.Label(root, text=”You walk the other way towards a crossroad.”)
    story_label.pack()
    continue_button = tk.Button(root, text=”Continue”, command=find_spooky_cave)
    continue_button.pack()

    def meet_trader():
    global inventory
    clear_screen()
    if inventory[“gold”] >= 1:
    story_text = f”The shady trader sees your gold.\n’Care for a biscuit? Just 1 gold piece.’\n(You have: {inventory[‘gold’]} gold)”
    story_label = tk.Label(root, text=story_text)
    story_label.pack()
    live_button = tk.Button(root, text=”Trade with him”, command=live)
    live_button.pack()
    away_button = tk.Button(root, text=”No thanks”, command=go_away)
    away_button.pack()
    else:
    story_text = f”The shady trader looks you over, sees you have no gold, and scoffs.\n’Don’t waste my time.’\n(You have: {inventory[‘gold’]} gold)”
    story_label = tk.Label(root, text=story_text)
    story_label.pack()
    back_button = tk.Button(root, text=”Go Back”, command=go_right)
    back_button.pack()

    def go_left():
    clear_screen()
    story_label = tk.Label(root, text=”You walk down a path and find a shiny key.”)
    story_label.pack()
    chest_button = tk.Button(root, text=”Open Chest”, command=open_chest)
    chest_button.pack()
    door_button = tk.Button(root, text=”Try Door”, command=try_door)
    door_button.pack()
    back_button = tk.Button(root, text=”Go Back”, command=start_game)
    back_button.pack()

    def go_right():
    clear_screen()
    story_label = tk.Label(root, text=”You walk towards a river. The water is flowing quickly.”)
    story_label.pack()
    trader_button = tk.Button(root, text=”Meet the shady trader”, command=meet_trader)
    trader_button.pack()
    away_button = tk.Button(root, text=”Go away from the river”, command=go_away)
    away_button.pack()
    back_button = tk.Button(root, text=”Go Back”, command=start_game)
    back_button.pack()

    def start_game():
    clear_screen()
    story_label = tk.Label(root, text=”You wake up in a dark forest. You can go left or right.”)
    story_label.pack()
    left_button = tk.Button(root, text=”Go Left”, command=go_left)
    left_button.pack()
    right_button = tk.Button(root, text=”Go Right”, command=go_right)
    right_button.pack()

    # — Main Program Setup —
    root = tk.Tk()
    root.title(“My Adventure Game”)
    root.geometry(“400×300”)

    start_button = tk.Button(root, text=”Start Game”, command=start_game)
    start_button.pack()

    root.mainloop()

    EXPLAIN CODE

    Here I will explain what all my code does in a very simple manner so that everyone can understand

    Libraries

    for this project, you need to install the tinker library for python. If u do not, this code will not work. Here is a link to the library so you can download it

    https://www.tcl-lang.org/software/tcltk/download.html

    import tkinter as tk

    This code is very important as it brings the tinker library into our code and allows us to do actions like creating a new window and adding a button

    inventory = {
    “gold”: 0,
    “sword”: False,
    “biscuit”: False,
    “strange_key”: False
    }

    This code creates our inventory and allows for different results in our game. We can set these items to 0 or false 

    def clear_screen():
    for widget in root.winfo_children():
    widget.destroy()

    This code creates a function that erases the screen after a choice is made and we use this everytime we’ve made a choice in the game

    FUNCTIONS

    In my game I have alot of functions like

    EX.

    def fight_the_bear() :

    def hide_from_bear() :

    def go_left() :

    def go_right() :

    each of theese functions are like pages in our story. Each of these functions is the pages that allow the player to choose between 2 actions

    MAIN REPEATED CODE

    In my game all of the options and text afterwards are all construced by 4 different set of codes

    story_label = tk.Label(root, text=)

    this code makes the lines of text you see before you click on one of the buttons

    X_button.pack()

    This code makes our buttons actually function and acts like a hand that flips the page after each choice

    Story_text = X

    This is the code that displays a longer line of text after you have clicked on one of the buttons and made your choice

    X_Button = tk.Button(root, text=””z, command =Y)

    This is one of teh msot important part’s of our code. This code creates the buttons for our game. X has to be part of one of our functions so that it can connect back to it. Z is the text that will be displayed on the button (EX. Go left). Y is the next function or scene we want to go to after we click on this button (EX. We click on go left Go Left => Open Chest) we would put Open_Chest where Y is and it would lead us to that scene.

    More EX.

    continue_button = tk.Button(root, text=”Follow the noise”, command=meet_bear)

    This will display a continue button and move us to the scene where we meet the bear

  • Hello world!

    Welcome to User’s blog Sites. This is your first post. Edit or delete it, then start writing!