How do i make a game director in python?

Luke B

Im trying to make a game director in python, but failing miserably as when i try to open the second program, it does in the order, so first 1, then 2, etc here is a part of my code:

*import os
print('What game do you want to play?')
print('1.  Hangman')
print('2.  Dragon Realm')
print('3.  Crafting Challenge')
gamechoice = input()
if gamechoice == '1':
    print('Ok, sending you there...')
os.startfile('hangman.py')
gamechoice = input()
if gamechoice == '2':
    print('Ok, sending you there...')
os.startfile('Dragon Realm.py')
gamechoice = input()
if gamechoice == '3':
    print('Ok, sending you there...')
os.startfile('crafting challenge.py')*
Andreas Argelius

You only need to get the input once. And in the if-statements you need to indent properly so you don't execute code that you didn't mean too.

Something like this might work:

import os
print('What game do you want to play?')
print('1.  Hangman')
print('2.  Dragon Realm')
print('3.  Crafting Challenge')

gamechoice = input()
print('Ok, sending you there...')

if gamechoice == 1:
    os.startfile('hangman.py')
elif gamechoice == 2:
    os.startfile('Dragon Realm.py')
elif gamechoice == 3:
    os.startfile('crafting challenge.py')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I find the installation director of 'make' in windows 10?

From Dev

How do I make an engine to change the current area of a game in Python?

From Dev

How do I make an engine to change the current area of a game in Python?

From Dev

How do I make my "Lingo" game in python 3.5 work?

From Dev

In a Spring & Ball Game how do I make the Collider push the ball?

From Dev

How do I make images change with a rock, paper, scissors game?

From Dev

In a Spring & Ball Game how do I make the Collider push the ball?

From Dev

When the screen is touched, how do I make the game over?

From Dev

How do I make HTML5 game obstacles?

From Dev

How do I make a python script executable?

From Dev

Numerical Python - how do I make this a ufunc?

From Dev

How do I make an object mutable in python?

From Dev

how do i make a nested dictionary in python?

From Dev

How do I make a float in Python?

From Dev

How do I make a grid in python?

From Dev

How do I make this python app installable?

From Dev

How do I make a timer in python?

From Dev

LibGDX - how do I make my game work on all screen resolutions?

From Dev

How do I make a game object move continuously as long as the key is pressed?

From Dev

How do I make the canvas endless for an infinite runner type of game in JS

From Dev

Python: How do you make a variable = 1 and it still being that way in a different def block? (For a game)

From Dev

Python: CARD GAME BOT - Remastering (How do you make a line continue regardless of where it is?)

From Dev

Python: How do you make a variable = 1 and it still being that way in a different def block? (For a game)

From Dev

How do I make Python3 the default Python in Geany

From Dev

How do I load a game in Java but also return to the state the game was in?

From Dev

I am making a GUI based text adventure game in Java. How do I make the message boxes update to show the outcomes?

From Dev

How do I maximise the sum in this game?

From Dev

How do I write a game loop in Haskell?

From Dev

How do I implement the "game loop" in Erlang?

Related Related

  1. 1

    How do I find the installation director of 'make' in windows 10?

  2. 2

    How do I make an engine to change the current area of a game in Python?

  3. 3

    How do I make an engine to change the current area of a game in Python?

  4. 4

    How do I make my "Lingo" game in python 3.5 work?

  5. 5

    In a Spring & Ball Game how do I make the Collider push the ball?

  6. 6

    How do I make images change with a rock, paper, scissors game?

  7. 7

    In a Spring & Ball Game how do I make the Collider push the ball?

  8. 8

    When the screen is touched, how do I make the game over?

  9. 9

    How do I make HTML5 game obstacles?

  10. 10

    How do I make a python script executable?

  11. 11

    Numerical Python - how do I make this a ufunc?

  12. 12

    How do I make an object mutable in python?

  13. 13

    how do i make a nested dictionary in python?

  14. 14

    How do I make a float in Python?

  15. 15

    How do I make a grid in python?

  16. 16

    How do I make this python app installable?

  17. 17

    How do I make a timer in python?

  18. 18

    LibGDX - how do I make my game work on all screen resolutions?

  19. 19

    How do I make a game object move continuously as long as the key is pressed?

  20. 20

    How do I make the canvas endless for an infinite runner type of game in JS

  21. 21

    Python: How do you make a variable = 1 and it still being that way in a different def block? (For a game)

  22. 22

    Python: CARD GAME BOT - Remastering (How do you make a line continue regardless of where it is?)

  23. 23

    Python: How do you make a variable = 1 and it still being that way in a different def block? (For a game)

  24. 24

    How do I make Python3 the default Python in Geany

  25. 25

    How do I load a game in Java but also return to the state the game was in?

  26. 26

    I am making a GUI based text adventure game in Java. How do I make the message boxes update to show the outcomes?

  27. 27

    How do I maximise the sum in this game?

  28. 28

    How do I write a game loop in Haskell?

  29. 29

    How do I implement the "game loop" in Erlang?

HotTag

Archive