Story
“La Speluna”, a company from San Escobar contacted Codecool and asked about creating a roguelike game for them. They didn’t tell us much about their needs, only few details about the game’s framework. They are big fans of old-fashioned RPG games, when graphics didn’t matter that much, but the most important things were a gameplay and a story.
The game should be about a creature (human? alien? bear? ant?) who is travelling through a dangerous and wild world (planet? table?). At the beginning the creature is weak and fragile, but through the game he (she? it? apache helicopter?) will be leveling up, getting tougher, collecting powerful items and finally be able to defeat an ultimate boss! Of course, the way to the ultimate boss isn’t a bed of roses, there will be a lot of obstacles (rivers? lavas? mountains?) and many dangerous enemies (use your imagination!).
What is a roguelike game? You can read about it on wikipedia or you can take a look at pictures below:
Warm up:
- Prepare a simple game board - a rectangle made by # character.
- Create a player using @ character.
- Make player movement - WSAD keys (please read a hint at the bottom of this page).
- Comment every line of your program to describe what’s going on in it. Use technical language.
How to clear console terminal from Python?:
import os
os.system('clear')
How to read key in Python without pressing Enter button?:
def getch():
import sys, tty, termios
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
x = getch()
print(x)