jeudi 22 septembre 2016

Simple, random encounters in a python text-adventure.. I´m stuck

i recently started simple coding with python 3 and i´m stuck with a simple problem:


import random

def enemy_bandit01():
     bandit01 = {'race': 'human', 'weapon': 'a sword'}

def enemy_orc01():
     orc01 = {'race': 'orc', 'weapon': 'a club'}

def enemy_wolf01():
     wolf01 = {'race': 'wolf', 'weapon': 'claws'}

encounter_choice = [enemy_bandit01, enemy_orc01, enemy_wolf01]

print('You fight against a ____. He has ____!')


I simply want python to pick a random enemy_x - function and then print out a text which includes the race/weapon etc.. without writing a new text for every enemy.

I am aware that this is a noob question, but i was not able to figure this out by myself.

Greetings, BobJohn :)




Aucun commentaire:

Enregistrer un commentaire