Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top python game engines: Ren'Py files #258

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions top-python-game-engines/renpy/basic_game/game/script.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ label start:

"You hear your alarm going off, and your mother calling to you."

mom "It's time to wake up. If I can hear your alarm, you can hear it to - let's go!"
mom "It's time to wake up. If I can hear your alarm,
you can hear it to - let's go!"

"Reluctantly you open your eyes."

Expand All @@ -25,13 +26,13 @@ label start:

# This shows the basic narration

"You awaken in your bedroom after a good night's rest. Laying there sleepily,
your eyes wander to the clock on your phone."
"You awaken in your bedroom after a good night's rest.
Laying there sleepily, your eyes wander to the clock on your phone."

me "Yoinks! I'm gonna be late!"

"You leap out of bed and quickly put on some clothes. Grabbing your book bag, you
sprint for the door to the living room."
"You leap out of bed and quickly put on some clothes.
Grabbing your book bag, you sprint for the door to the living room."

scene hallway day

Expand Down
87 changes: 68 additions & 19 deletions top-python-game-engines/renpy/giant_quest_game/game/giant.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ label giant_battle:

show expression current_weapon at left

"As you follow the tracks down the path, night falls. You hear sounds in the distance: cows, goats, sheep. You've found the livestock!"
"As you follow the tracks down the path, night falls.
You hear sounds in the distance:
cows, goats, sheep. You've found the livestock!"

show giant greeting

"As you approach the clearing and see your villages livestock, a giant appears."
"As you approach the clearing and see your villages livestock,
a giant appears."

giant "Who are you?"

Expand All @@ -43,22 +46,41 @@ python:
elif giant_hp < 20:
renpy.say(None, "The giant's steps become more unsteady.")
elif giant_hp < 30:
renpy.say(None, "The giant sweats and wipes the blood from his brow.")
renpy.say(
None, "The giant sweats and wipes the blood from his brow."
)
elif giant_hp < 40:
renpy.say(None, "The giant snorts and grits his teeth against the pain.")
renpy.say(
None,
"The giant snorts and grits his teeth against the pain.",
)
else:
renpy.say(None, "The giant smiles and readies himself for the attack.")

renpy.say(
None,
"The giant smiles and readies himself for the attack.",
)

def show_player_condition(player_hp):
if player_hp < 4:
renpy.say(None, "Your eyes lose focus on the giant as you sway unsteadily.")
renpy.say(
None,
"Your eyes lose focus on the giant as you sway unsteadily.",
)
elif player_hp < 8:
renpy.say(None, "Your footing becomes less steady as you swing your sword sloppily.")
renpy.say(
None,
"Your footing becomes less steady as you swing your sword sloppily.",
)
elif player_hp < 12:
renpy.say(None, "Blood mixes with sweat on your face as you wipe it from your eyes.")
renpy.say(
None,
"Blood mixes with sweat on your face as you wipe it from your eyes.",
)
elif player_hp < 16:
renpy.say(None, "You bite down as the pain begins to make itself felt.")
renpy.say(
None,
"You bite down as the pain begins to make itself felt.",
)
else:
renpy.say(None, "You charge into the fray valiantly!")

Expand All @@ -75,16 +97,31 @@ python:
# Keep swinging until something happens
while not battle_over:

renpy.say(None, "You have {0} hit points. Do you want to fight or flee?".format(player_hp), interact=False)
battle_over = renpy.display_menu([ ("Fight!", False), ("Flee!", True) ])
renpy.say(
None,
"You have {0} hit points. Do you want to fight or flee?".format(
player_hp
),
interact=False,
)
battle_over = renpy.display_menu(
[("Fight!", False), ("Flee!", True)]
)

if battle_over:
player_wins = False
break

# The player gets a swing
player_attack = randint(1, base_damage + 1) * multiplier + additional
renpy.say(None, "You swing your {0}, doing {1} damage!".format(current_weapon, player_attack))
player_attack = (
randint(1, base_damage + 1) * multiplier + additional
)
renpy.say(
None,
"You swing your {0}, doing {1} damage!".format(
current_weapon, player_attack
),
)
giant_hp -= player_attack

# Is the giant dead?
Expand All @@ -98,9 +135,17 @@ python:
# Then the giant tries
giant_attack = randint(0, giant_damage)
if giant_attack == 0:
renpy.say(None, "The giant's arm whistles harmlessly over your head!")
renpy.say(
None,
"The giant's arm whistles harmlessly over your head!",
)
else:
renpy.say(None, "The giant swings his mighty fist, and does {0} damage!".format(giant_attack))
renpy.say(
None,
"The giant swings his mighty fist, and does {0} damage!".format(
giant_attack
),
)
player_hp -= giant_attack

# Is the player dead?
Expand All @@ -119,10 +164,11 @@ python:
else:
renpy.jump("giant_wins")


label player_wins:

"The giant's eyes glaze over as he falls heavily to the ground. The earth shakes as his bulk lands face down, and his death rattle fills the air."
"The giant's eyes glaze over as he falls heavily to the ground.
The earth shakes as his bulk lands face down,
and his death rattle fills the air."

hide giant

Expand All @@ -132,7 +178,10 @@ label player_wins:

label giant_wins:

"The giant takes one last swing, knocking you down. Your vision clouds, and you see the ground rising to meet you. As you slowly lose consciousness, your last vision is the smiling figure of the giant as he advances on you."
"The giant takes one last swing, knocking you down.
Your vision clouds, and you see the ground rising to meet you.
As you slowly lose consciousness, your last vision is
the smiling figure of the giant as he advances on you."

"You have lost!"

Expand Down
25 changes: 17 additions & 8 deletions top-python-game-engines/renpy/giant_quest_game/game/script.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## Declare characters used by this game. The color argument colorizes the
## name of the character.
define player = Character("Me", color="#c8ffff")
define smith = Character("Miranda, village blacksmith", color="#2a3236")
define smith = Character("Miranda, village blacksmith", color="#99ff9c")
define wizard = Character("Endeavor, cryptic wizard", color="#f4d3ff")
define giant = Character("Maull, terrifying giant", color="#ff8c8c")

Expand Down Expand Up @@ -55,24 +55,33 @@ label start:

# Begin narration

"Growing up in a small hamlet was boring, but reliable and safe. At least, it was until the neighbors began complaining of missing livestock. That's when the evening patrols began."
"Growing up in a small hamlet was boring, but reliable and safe.
At least, it was until the neighbors began complaining of missing
livestock. That's when the evening patrols began."

"While on patrol just before dawn, your group noticed broken fence around a cattle paddock. Beyond the broken fence, a crude trail had been blazed to a road leading away from town."
"While on patrol just before dawn, your group noticed broken fence
around a cattle paddock. Beyond the broken fence,
a crude trail had been blazed to a road leading away from town."

# Show the current weapon
show expression current_weapon at left
with moveinleft

"After reporting back to the town council, it was decided that you should follow the tracks to discover the fate of the livestock. You picked up your only weapon, a simple wooden practice sword, and set off."
"After reporting back to the town council, it was decided that you
should follow the tracks to discover the fate of the livestock.
You picked up your only weapon, a simple wooden practice sword,
and set off."

scene crossroads
with fade

show expression current_weapon at left

"Following the path, you come to a bridge across the river."

"Crossing the bridge will take you to the county seat, where you may hear some news or get supplies. The tracks, however, continue straight on the path."

"Crossing the bridge will take you to the county seat,
where you may hear some news or get supplies.
The tracks, however, continue straight on the path."

menu optional_name:
"Which direction will you travel?"
Expand All @@ -82,7 +91,7 @@ label start:
jump town
"Continue on the path":
jump path

"Your quest is ended!"

return
45 changes: 29 additions & 16 deletions top-python-game-engines/renpy/giant_quest_game/game/town.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,40 @@ image blacksmith confused = "blacksmith2.png"
image blacksmith happy = "blacksmith3.png"
image blacksmith shocked = "blacksmith4.png"


label town:

scene distant town
with fade

show expression current_weapon at left

"Crossing the bridge, you stride away from the river along a well worn path. The way is pleasant, and you find yourself humming a tune as you break into a small clearing."
"Crossing the bridge, you stride away from the river along a
well worn path. The way is pleasant, and you find yourself humming
a tune as you break into a small clearing."

"From here, you can make out the county seat of Fetheron. You feel confident you can find help for your quest here."
"From here, you can make out the county seat of Fetheron.
You feel confident you can find help for your quest here."

scene within town
with fade

show expression current_weapon at left

"As you enter town, you immediately begin seeking the local blacksmith. After asking one of the townsfolk, you find the smithy on the far south end of town. You approach the smithy, smelling the smoke of the furnace long before you hear the pounding of hammer on steel."
"As you enter town, you immediately begin seeking the local blacksmith.
After asking one of the townsfolk, you find the smithy on the far
south end of town. You approach the smithy,
smelling the smoke of the furnace long before you hear
the pounding of hammer on steel."

player "Hello! Is the smith in?"

smith "Who wants to know?"

show blacksmith greeting

"The blacksmith appears from her bellows. She greet you with a warm smile."

"The blacksmith appears from her bellows.
She greets you with a warm smile."

smith "Oh, hello! You're from the next town over, right?"

menu:
Expand All @@ -51,14 +58,14 @@ label town:
show blacksmith shocked

smith "Hey, just trying to make conversation"

smith "So, what can I do for you?"

player "I need a better weapon that this wooden thing."
player "I need a better weapon than this wooden thing."

show blacksmith confused

smith "Are you going be doing something dangerous?"
smith "Are you going to be doing something dangerous?"

player "Have you heard about the missing livestock in town?"

Expand All @@ -70,17 +77,21 @@ label town:

player "Exactly! Can you help?"

smith "I've got just the thing. Been working on it for a while, but didn't know what to do with it. Now I know"
smith "I've got just the thing. Been working on it for a while,
but didn't know what to do with it. Now I know."

"Miranda walks back past the furnace to a small rack. On it, a gleaming steel sword rests. She picks it up and walks back to you."
"Miranda walks back past the furnace to a small rack.
On it, a gleaming steel sword rests.
She picks it up and walks back to you."

smith "Will this do?"

menu:
"It's perfect!":
show blacksmith happy

smith "Wonderful! Give me the wooden one - I can use it in the furnace!"
smith "Wonderful! Give me the wooden one -
I can use it in the furnace!"

$ current_weapon = "steel sword"
$ base_damage = 6
Expand All @@ -89,8 +100,9 @@ label town:
"Is that piece of junk it?":
show blacksmith confused

smith "I worked on this for weeks. If you don't want it, then don't take it."

smith "I worked on this for weeks.
If you don't want it, then don't take it."

# Show the current weapon
show expression current_weapon at left

Expand All @@ -100,12 +112,13 @@ label town:

smith "Alright. Good luck!"


scene distant town
with fade

show expression current_weapon at left

"You make your way back through town. Glancing back at the town, you hope you wonder if you can keep them safe too."
"You make your way back through town.
Glancing back at the town, you wonder if
you can keep them safe too."

jump path