Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.9 kB
2
Indexable
-- Create a simple text-based game
-- Description: You are an adventurer in a dark and eerie forest, and
-- your goal is to navigate through its depths in search of the sacred amulet
-- of light that will dispel the darkness. On your way, you will encounter various
-- creatures and obstacles that will challenge your prowess as a warrior. Will you
-- make it out alive, or will you fall victim to the forest's perils?

local current_location = 'You find yourself in a dark and eerie forest.

The air is thick with the smell of decay and the sound of distant howls echoes through
the trees.

To your north is a winding path that leads deeper into the forest.
To your south is an imposing cave that could lead you onward or possibly be your downfall.

What would you like to do?'

function move(direction)
current_location = current_location .. 'You move ' .. direction ..'. As you push through the underbrush,' ..

'you stumble upon an ancient statue of a warrior in a defensive stance.
In its hand is a glowing amulet. It seems to be the amulet of light you've been searching for.

You're just about to grab it when it suddenly turns into a demonic entity.
Its eyes glow with an unearthly light and its mouth opens to reveal a row of sharp teeth.

It lets out a shrill scream and pounces, aiming right for your throat.
What would you like to do?'
end

function fight_monster()
print('You have fallen in battle, but the amulet of light is still in play.
The demon picks it up, and with a maniacal laugh, he uses it to banish the darkness and
bring light to the forest.
It appears that the forest is once again at peace, and thanks to your efforts, the
amulet of light will keep it that way for many years to come.

You may die, but you have died a hero.

Congratulations, you have won the game!'
end

function start_game()
print('Welcome to the dark and eerie forest, dear adventurer.
Are you ready to embark on your quest? ')