Turn-based runner in Python
Text translated by Google translator
Tired of writing bots for the blockchain GOLOS. I decided to unwind a bit and flipping through a python book decided to write a couple of simple games. My acquaintance with computers began with "Microsha". As I now remember this ANSI-graphics. For example, this is a screenshot, with a flying superman, from the game "Circus", an analog of Arkanoid.
I tried several options, I came to the conclusion that the python + cmd bundle imposes a lot of restrictions. Looking to the side of pygame now there is no time. I had to fit into the existing framework. The result of small pickings was the first game, Runner!
The goal is to run as far as possible. From whom? It seems now fashionable to escape from zombies. View from above. "X" is you, "O" trees. This is a compact kind of "screen".
The control involves three keys. "Left", "Right" and "Forward". In fact, "forward" is when you do not need to either left or right. With each press you advance one meter. Time to think, as many as you like. Video gameplay. That would not strongly delay, established an accelerated set of the level of complexity.
Those who already know how to program, further reading is not recommended. Now there will be a shit-code from the person who writes on the python after reading only the first few chapters of the textbook. Necessary comments are left.
I do not know how to insert formatted code into busy. I attach the screenshots of the code.
Of the complexities, I can note that the IDLE python editor can not process the command os.system ('cls') - cleaning the screen. Because of this, I had to write a bat-file to view the results of the program in a separate cmd window. The bat-file code is simple.
@echo off
title "GAME - Runner"
"C:\ Program Files\Python35\python.exe" "runner.py"
pause
The msvcrt module is used to handle keystrokes. If correctly understood, initially it was only for Windows. But some craftsmen can screw it in the * nix system.
On the Github, this creation, to spread is not appropriate. Do an exe file and even more so. Here the code is two kilobytes, and the accompanying libraries are a hundred times more adhered. In general, the result is satisfied. The plan has turned out. The truth is confused by the friezes that arise. But I think it's a cmd problem, rather than a Python or my code.
Thank you for attention. I hope you coped with the Google translation.
Leave Turn-based runner in Python to:
Read more #gamedev posts
Best Posts From VIRT
We have not curated any of virt's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From VIRT
- Три способа как бесплатно пользоваться мобильной связью и мобильным интернетом
- Check my latest fight ! maquemali vs virt
- Рыбка - small fish
- ВД "Итог"
- Перьевые ручки моего детства
- Воксельная диорама "Выборы 20!8"
- Воксельная диорама "12 чемоданов"
- Answers to questions about Russia
- Подарок от Сбербанка
- Продажа апов на steemit.com (инструкция в картинках)