0% found this document useful (0 votes)
16 views

05 Basic Text-Based Adventure Game

The document outlines the creation of a basic text-based adventure game where users navigate through a storyline by making choices. It includes steps for developing game logic, writing Python code, and testing the game, along with suggestions for adding features like a play-again option and more complex storylines. The project is designed for beginners to practice Python programming.

Uploaded by

andromarky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

05 Basic Text-Based Adventure Game

The document outlines the creation of a basic text-based adventure game where users navigate through a storyline by making choices. It includes steps for developing game logic, writing Python code, and testing the game, along with suggestions for adding features like a play-again option and more complex storylines. The project is designed for beginners to practice Python programming.

Uploaded by

andromarky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Basic Text-Based Adventure Game

Basic Text-Based Adventure Game ဆိုတာက user တတေအတေက် စာသားအတြေြြု စိတ်ကူးယဉ်ဂိမ်းတစ်ေုြြစ်ြါ


တယ်။ ဒီ project မှာ user က တွေးေျယ်မှတတေေုြ််ြီး ဇာတ်ေမ်းတစ်ေုကို ေိုက်ြါကစားွမှာြြစ်ြါတယ်။

အဆင့် 1: Game Logic ကို စဉ်းစားပါ


- User ကို ဇာတ်ေမ်းအစတြြာြြြါမယ်။
- User ကို တွေးေျယ်မှတတေ တြးြါမယ်။
- User ွဲ့ တွေးေျယ်မှတြေမူတူ််ြီး ဇာတ်ေမ်းကို တြြာင်းေဲသေားြါမယ်။
- ဂိမ်းွဲ့ အဆုံးသတ်ကို user ွဲ့ တွေးေျယ်မှတတေတြေ မူတူ််ြီး ဆုံးြြတ်ြါမယ်။

အဆင့် 2: Python Code ကို ရေးသားပါ


အဆင့် 2.1: ဇာတ်လမ်းအစနဲ့ ရေေးချယ်မှရတွကို ဖန်တီးပါ
ြထမဆုံး ဇာတ်ေမ်းအစနဲ့ တွေးေျယ်မှတတေကို ြန်တီးြါမယ်။
python
def start_game():
print("Welcome to the Text-Based Adventure Game!")
print("You find yourself in a dark forest. There are two paths in front of you.")
print("1. Take the left path")
print("2. Take the right path")

choice = input("Enter your choice (1 or 2): ")

if choice == '1':
left_path()
elif choice == '2':
right_path()
else:
print("Invalid choice! Please try again.")
start_game()

def left_path():
print("\nYou chose the left path.")
print("You encounter a river. There is a boat nearby.")
print("1. Take the boat")
print("2. Swim across the river")

choice = input("Enter your choice (1 or 2): ")

if choice == '1':
print("You take the boat and safely cross the river. You win!")
elif choice == '2':
print("You try to swim but get caught in the current. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
1
def right_path():
print("\nYou chose the right path.")
print("You find a cave. There is a treasure chest inside.")
print("1. Open the chest")
print("2. Ignore the chest and continue")

choice = input("Enter your choice (1 or 2): ")

if choice == '1':
print("You open the chest and find gold! You win!")
elif choice == '2':
print("You continue walking but get lost in the cave. Game over!")
else:
print("Invalid choice! Please try again.")
right_path()

# Start the game


start_game()

အဆင့် 3: Code ကို Run ပပီး စမ်းသပ်ပါ


ဒီ code ကို run ်ြီး ဂိမ်းကို စမ်းသြ်ကကူ့်ြါ။
Example Output:
Welcome to the Text-Based Adventure Game!
You find yourself in a dark forest. There are two paths in front of you.
1. Take the left path
2. Take the right path
Enter your choice (1 or 2): 1

You chose the left path.


You encounter a river. There is a boat nearby.
1. Take the boat
2. Swim across the river
Enter your choice (1 or 2): 1
You take the boat and safely cross the river. You win!

အဆင့် 4: Features ရတွ ထပ်ထည့်ပါ


ဒီ project ကို ြို်ြီး စိတ်ဝင်စားြို့တကာင်းတအာင် features တတေ ထြ်ထူ့်နိုင်ြါတယ်။

Feature 1: Play Again Option ထည့်ပါ


User ကို တနာက်တစ်ကကိမ် ထြ်ကစားေျင်ေားေို့ တမးြါမယ်။
python
def play_again():
choice = input("Do you want to play again? (yes/no): ").lower()
if choice == 'yes':

2
start_game()
else:
print("Thanks for playing! Goodbye!")

def left_path():
print("\nYou chose the left path.")
print("You encounter a river. There is a boat nearby.")
print("1. Take the boat")
print("2. Swim across the river")

choice = input("Enter your choice (1 or 2): ")

if choice == '1':
print("You take the boat and safely cross the river. You win!")
elif choice == '2':
print("You try to swim but get caught in the current. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
play_again()

def right_path():
print("\nYou chose the right path.")
print("You find a cave. There is a treasure chest inside.")
print("1. Open the chest")
print("2. Ignore the chest and continue")

choice = input("Enter your choice (1 or 2): ")

if choice == '1':
print("You open the chest and find gold! You win!")
elif choice == '2':
print("You continue walking but get lost in the cave. Game over!")
else:
print("Invalid choice! Please try again.")
right_path()
play_again()

# Start the game


start_game()

Feature 2: More Complex Storylines ထည့်ပါ


ဇာတ်ေမ်းကို ြို်ြီး ရှြ်တထေးတအာင် ေုြ်ြါမယ်။
python
def left_path():
print("\nYou chose the left path.")
print("You encounter a river. There is a boat nearby.")
print("1. Take the boat")
print("2. Swim across the river")

3
choice = input("Enter your choice (1 or 2): ")

if choice == '1':
print("You take the boat and safely cross the river.")
print("You find a village. The villagers offer you food and shelter.")
print("1. Accept their offer")
print("2. Continue your journey")

choice = input("Enter your choice (1 or 2): ")

if choice == '1':
print("You live happily in the village. You win!")
elif choice == '2':
print("You continue your journey but get lost in the wilderness. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
elif choice == '2':
print("You try to swim but get caught in the current. Game over!")
else:
print("Invalid choice! Please try again.")
left_path()
play_again()

အဆင့် 5: Project ကို ပပီးရအာင် လုပ်ပါ


ဒီ project ကို ြို်ြီးစိတ်ဝင်စားြို့တကာင်းတအာင် ကိုယ်ြိုင် features တတေ ထြ်ထူ့်နိုင်ြါတယ်။ ဥြမာ-
- Inventory system ထူ့်ြါ။
- Random events ထူ့်ြါ။
- GUI (Graphical User Interface) ထူ့်ြါ။

ဒီ project က beginner တတေအတေက် Python programming ကို ေက်တတေ့တေ့ကျင့်ြို့ တကာင်းတဲ့ project တစ်ေု
ြြစ်ြါတယ်။

Myat Lynn (M.Tech)


(DataSync)
t.me/DataSync2024

You might also like