Create a Choose Your Own Adventure game using Ask for user input and the toolkit! Create…
- User
Create a Choose Your Own Adventure game using Ask for user input and the toolkit! Create that the conditionals call, so you can use the functions more than once!
this a example dont make it copied make something diffrent like the background stage.set_background(“subway”)
EXAMPLE:
------------------------------ ### ### MINIMUM TECHNICAL REQUIREMENTS ### ### ------------------------------ ### # Create scenes using functions def go_to_space(): stage.set_background("space") lucy.glide_to(0,0) lucy.say("Whoa space is cool!") lucy.turn_right(360) def go_to_city(): stage.set_background("city") lucy.move_down(25) lucy.say("Amazing, the big city! So much to do here!") lucy.move_left(100) lucy.say("Let's get going!") stage.wait(1) lucy.move_right(400) def go_to_park(): stage.set_background("park") lucy.say("Ahh so nice, I love the park!") dog = codesters.Sprite("dog", -500, -50) dog.glide_to(500, -50) lucy.say("I think I'll stay here and watch the dogs play!") def go_to_mars(): stage.set_background("mars") lucy.say("Mars is bright tonight!") ufo = codesters.Sprite("ufo", 300, -300) ufo.set_x_speed(5) ufo.set_y_speed(5) lucy.say("OMG a UFO!") def go_to_moon(): stage.set_background("moon") lucy.glide_to(-100,-100) lucy.say("It seems kinda lonely on the moon...") stage.wait(2) alien = codesters.Sprite("alien2",100,-400) alien.glide_to(100,-250) alien.say("Hello!") stage.wait(2) alien.glide_to(50,-100) alien.say("Welcome to the moon!") lucy.say("Thanks! Can you show me around?") def ride_subway(): stage.set_background("subway") lucy.set_size(1.5) lucy.glide_to(0, -100) lucy.say("I can't believe there's an entire train underground!") for counter in range(2,5): person = codesters.Sprite("person"+str(counter),-300,-100) person.set_size(1.5) person.say("Excuse me!") person.move_right(800) lucy.say("Wow, lots of people take the subway!") def go_to_concert(): stage.set_background("concert") lucy.say("Awesome! I love concerts!") lucy.glide_to(150,-225) singer = codesters.Sprite("person3",-300,-50) singer.set_size(.75) singer.glide_to(0,-50) singer.say("WHO'S READY FOR SOME FUN?!") lucy.say("MEEEE!!!!!!!!!!!!!!") stage.wait(1) singer.move_left(200) singer.say("GET PUMPED UP!") stage.wait(1) singer.move_right(400) singer.say("LALA LAAAA LADIDADA") singer.move_left(200) # Include a stage and sprite to guide the player stage.set_background("houseinterior") lucy = codesters.Sprite("person1",0,-150) # Use .ask() to help the player to choose between scenes choice = lucy.ask("Should we go to a) space b) the city or c) the park?") # Call functions depending on the player's answer # with an if statement, elif statement, and else statement! if choice == "a": go_to_space() choice = lucy.ask("Should we a) go to Mars or b) go to the moon?") if choice == "a": go_to_mars() elif choice == "b": go_to_moon() elif choice == "b": go_to_city() choice = lucy.ask("Should I a) ride the subway or b) go to a concert?") if choice == "a": ride_subway() elif choice == "b": go_to_concert() else: go_to_park() lucy.say("What an awesome adventure today!")
- Assistant
- User
There is no sprite with image label: medieval_village
- Assistant
If the specific image label "medieval_village" is not available in your platform's asset library, you'll need to use a label that corresponds to an existing background image. Let's change the background to something generic like "village" which is likely to exist in any typical library of assets for a game platform. If "village" also doesn't exist, replace it with any background name from your platform's available resources.
Here's the updated initial part of the code snippet with the generic "village" background:
# Use .ask() to start the adventure and guide the player to choose between scenes stage.set_background("village") knight = codesters.Sprite("knight", 0, -150) choice = knight.ask("Do you wish to explore the castle or roam the village? a) Castle b) Village") if choice == "a": explore_castle() elif choice == "b": roam_village() # assume you have implemented this function or replace it accordingly else: knight.say("I didn't quite catch that. Let's head to the castle!") explore_castle() knight.say("What a grand adventure we had!")