diff options
| author | Syndamia <kami02882@gmail.com> | 2019-07-29 11:46:36 +0300 |
|---|---|---|
| committer | Syndamia <kami02882@gmail.com> | 2019-07-29 11:46:36 +0300 |
| commit | bc09da5a7b65b08b5d5dcd1e90173ad3b6081c23 (patch) | |
| tree | c66cebc02aac30ff859c06ca462f3dd58b6809b0 /Python/Beginner training/Game test.py | |
| parent | 65edf7296baf48aad1b4e0c09b57f1a7f48791a8 (diff) | |
| download | Self-learning-bc09da5a7b65b08b5d5dcd1e90173ad3b6081c23.tar Self-learning-bc09da5a7b65b08b5d5dcd1e90173ad3b6081c23.tar.gz Self-learning-bc09da5a7b65b08b5d5dcd1e90173ad3b6081c23.zip | |
Did some more work in Python and started officially learning Java
Diffstat (limited to 'Python/Beginner training/Game test.py')
| -rw-r--r-- | Python/Beginner training/Game test.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Python/Beginner training/Game test.py b/Python/Beginner training/Game test.py new file mode 100644 index 0000000..dd35499 --- /dev/null +++ b/Python/Beginner training/Game test.py @@ -0,0 +1,41 @@ +import sys +import math +import random +import os +import keyboard +import time + +ORIGINAL_MAP = [[' ', '>', '-', '-', '-', '-', ' '], + [' ', '|', ' ', ' ', ' ', '|', ' '], + [' ', '[', ' ', ' ', ' ', '|', ' '], + [' ', '-', '-', '-', '=', '-', ' ']] +map = ORIGINAL_MAP[:] + +player = '*' +xPos = 1; yPos = 0 + +def ReWriteScreen(): + map = ORIGINAL_MAP[:] + + for i in range(len(ORIGINAL_MAP)): + for j in range(len(ORIGINAL_MAP[0])): + if i == yPos: map[yPos][xPos] = player + + print(end=map[i][j]) + print() + +while True: + try: + if keyboard.is_pressed('w') and yPos > 0: + yPos -= 1 + elif keyboard.is_pressed('s') and yPos < 3: + yPos += 1 + elif keyboard.is_pressed('a') and xPos > 1: + xPos -= 1 + elif keyboard.is_pressed('d') and xPos < 5: + xPos += 1 + except: + continue + + ReWriteScreen() + time.sleep(1)
\ No newline at end of file |
