Turn-based runner in Python

in #gamedev6 years ago (edited)

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.
image.png
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!
image.png
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".
image.png
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.
image.png
image.png
image.png
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.

Sort:  

This post has received a 0.04 % upvote from @drotto thanks to: @banjo.

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by VIRT from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.032
BTC 62737.73
ETH 2925.66
USDT 1.00
SBD 3.50