Browse Source

Added glitterslikegold and changed the test file

master
crunk 3 years ago
parent
commit
d8c5c87462
  1. 110
      glitterslikegold.py
  2. 38
      test
  3. 27
      variawelcome80.txt

110
glitterslikegold.py

@ -0,0 +1,110 @@
"""Copy of tomb of doom not scrolling but glittering"""
import curses
import time
import random
# Using readlines()
file1 = open("test", "r")
lines = file1.readlines()
debug_text = False
def show_debug_text(stdscr, width, height, start_x_file):
"""debug text for the tomb of doom"""
whstr = "Width: {}, Height: {}".format(width, height)
stdscr.addstr(0, 0, whstr, curses.color_pair(1))
file_string = "X position of text: {}".format(start_x_file)
stdscr.addstr(1, 0, file_string, curses.color_pair(1))
def draw_glitter(stdscr):
# Clear and refresh the screen for a blank screen
# Set delay to no, to not wait for keyboard press
stdscr.nodelay(1)
stdscr.clear()
stdscr.refresh()
glitter_increase = 1
rotation = 1
# Start colors in curses
curses.start_color()
curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK)
curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_BLACK)
curses.init_pair(5, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
curses.init_pair(6, curses.COLOR_YELLOW, curses.COLOR_BLACK)
while True:
# Loop where k is the last character pressed
stdscr.clear()
height, width = stdscr.getmaxyx()
# Declaration of strings
title = "Curses from the Tomb of Doom, glitter like gold"[: width - 1]
subtitle = "Crunk Varia"[: width - 1]
hwidth = width // 2
# Centering calculations
start_x_title = int((hwidth) - (len(title) // 2) - len(title) % 2)
start_x_subtitle = int(
(hwidth) - (len(subtitle) // 2) - len(subtitle) % 2
)
start_y = int((height) - 2)
if debug_text:
show_debug_text(stdscr, width, height, glitter_increase)
line_count = 0
for line in lines:
ch_count = 0
for character in line:
if ch_count < width and ch_count > 0:
if random.randint(glitter_increase, 100) > 90:
stdscr.addch(
line_count,
ch_count,
character,
curses.color_pair(rotation),
)
ch_count += 1
line_count += 1
# Turning on attributes for title
stdscr.attron(curses.color_pair(2))
stdscr.attron(curses.A_BOLD)
# Rendering title
stdscr.addstr(start_y, start_x_title, title)
# Turning off attributes for title
stdscr.attroff(curses.color_pair(2))
stdscr.attroff(curses.A_BOLD)
stdscr.addstr(start_y + 1, start_x_subtitle, subtitle)
# Refresh the screen
stdscr.refresh()
time.sleep(1.0 / 30)
glitter_increase += 1
if glitter_increase > 99:
glitter_increase = 1
rotation += 1
if rotation > 6:
rotation = 1
key_pressed = stdscr.getch() != -1
if key_pressed:
raise KeyboardInterrupt()
def main():
curses.wrapper(draw_glitter)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
curses.endwin()
curses.curs_set(1)
curses.reset_shell_mode()
curses.echo()

38
test

@ -1,12 +1,26 @@
███████████████████████████████████████████████████████████████████████████████
██╔════════════╗█╔════════════╗█╔════════════╗█╔════════════╗█╔════════════╗███
██║ ▄▄▄▄ ▄▄▄ ║█║ ▄▄▄▄▄▄▄▄▄▄ ║█║ ██████████ ║█║ ██████████ ║█║ ██████████ ║███
██║ ████ ████ ║█║ ██████████ ║█║ ██████████ ║█║ ▀▀▀▀▀▀▀▀▀▀ ║█║ ██████████ ║███
██║ ████ ████ ║█║ ███ ███ ║█║ ██ ███▀ ║█║ ▄▄▄▄▄▄▄▄▄▄ ║█║ ███ ███ ║███
██║ ████ ████ ║█║ ██████████ ║█║ ████████ ║█║ ██████ ║█║ ██████████ ║███
██║ ████ ████ ║█║ ████▌▐████ ║█║ █████████ ║█║ ██████ ║█║ ████▌▐████ ║███
██║ ▓███ ▄████ ║█║ ▓███▌▐████ ║█║ ▓███▌▐███ ║█║ ██████ ║█║ ▓███▌▐████ ║███
██║ ▒▓███████▀ ║█║ ▒▓██▌▐████ ║█║ ▒▓██▌▐███ ║█║ ▓█████ ║█║ ▒▓██▌▐████ ║███
██║ ░▒▓█████▀ ║█║ ░▒▓█▌▐████ ║█║ ░▒▓█▌▐████ ║█║ ░▒▓█████▄▄ ║█║ ░▒▓█▌▐████ ║███
██╚════════════╝█╚════════════╝█╚════════════╝█╚════════════╝█╚════════════╝███
███████████████████████████████████████████████████████████████████████████████
. . . .
. . .
┌───┐ ┌───┐ ┌───────────┐ ┌─────────────┐ ┌──────────┐ ┌───────────┐
│░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│ .
│░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│
│░░░│ .│░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│
│▒▒▒│ │▒▒▒│ │▒▒▒┌───┐▒▒▒│ │▒▒▒┌─────┐▒▒▒│ └──┐▒▒▒▒┌──┘ │▒▒▒┌───┐▒▒▒│ .
│▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ . ┌┘▒▒▒│ . │▒▒▒▒│ │▒▒▒│ │▒▒▒│
│▒▒▒│ │▒▒▒│ │▒▒▒└───┘▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒▒│ │▒▒▒└───┘▒▒▒│
. │███│ │███│ │███████████│ │███└────┘████│ │████│ │███████████│
│███│ │███│ │███████████│ │████████████┌┘ .│████│ │███████████│
. │███│ │███│ │███████████│ │███████████ │ │████│ │███████████│
│▓▓▓│ │▓▓▓│ │▓▓▓┌───┐▓▓▓│ │▓▓▓┌──┐▓▓▓▓▓│ . │▓▓▓▓│. │▓▓▓┌───┐▓▓▓│
│▓▓▓│ │▓▓▓│.│▓▓▓│. │▓▓▓│ │▓▓▓│ └─┐▓▓▓│ │▓▓▓▓│ │▓▓▓│ │▓▓▓│
. │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓▓│ │▓▓▓│ │▓▓▓│
│▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒▒│ . │▒▒▒│ . │▒▒▒│ .
│▒▒▒▓▓▓▓▒▒▒▓▓▓▓▒▒▒▓▓▓▓▓▒▒▒▓▓│▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒│ │▒▒▒│
│▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒▒▓▓▓▓█│▒▒▒└─┐┌──┘▒▒▒▒└──┐ │▒▒▒│ │▒▒▒│
▓░░░░░░░░░░ ░░░░░░░░░░░░░░░░░▒▒▒▒▓▓░░░░░▓▓░░░░░░░░░░│ │░░░│ │░░░│
▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒░░░│ │░░░│
▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░▒▒░░░░░▒▒░░░░░░░░░░▓▓▓▓░░░│ │░░░│
▓▒▒░▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▓
▓▒░░▒▒▓▓▓▓███████ █████████████░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▓▒░░▒▒▓▓██████████ Welcome to the Varia House. ██████████████▒▒▒▒▒▒▒▒▒▒░░░░░░░░░
▒░░███████████████ ████████████████▓▓▓▓▓▓▓▓▓▓▓▓░░░░░
░███████████████████████████████████████████████████████████████████████▓▓▓▓▓░░

27
variawelcome80.txt

@ -0,0 +1,27 @@

....
...
 ┌───┐  ┌───┐ ┌───────────┐ ┌─────────────┐ ┌──────────┐ ┌───────────┐ 
 │░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│ . 
  │░░░│ │░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│  
  │░░░│ .│░░░│ │░░░░░░░░░░░│ │░░░░░░░░░░░░░│ │░░░░░░░░░░│ │░░░░░░░░░░░│  
   │▒▒▒│ │▒▒▒│ │▒▒▒┌───┐▒▒▒│ │▒▒▒┌─────┐▒▒▒│ └──┐▒▒▒▒┌──┘ │▒▒▒┌───┐▒▒▒│ .
   │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ . ┌┘▒▒▒│ . │▒▒▒▒│ │▒▒▒│ │▒▒▒│   
   │▒▒▒│ │▒▒▒│ │▒▒▒└───┘▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒▒│ │▒▒▒└───┘▒▒▒│  
 .   │███│ │███│ │███████████│ │███└────┘████│ │████│ │███████████│  
  │███│ │███│ │███████████│ │████████████┌┘ .│████│ │███████████│ 
 . │███│ │███│ │███████████│ │███████████ ││████│ │███████████│  
 │▓▓▓│ │▓▓▓│ │▓▓▓┌───┐▓▓▓│ │▓▓▓┌──┐▓▓▓▓▓│ . │▓▓▓▓│. │▓▓▓┌───┐▓▓▓│  
│▓▓▓│ │▓▓▓│.│▓▓▓│. │▓▓▓│ │▓▓▓│ └─┐▓▓▓││▓▓▓▓│ │▓▓▓│ │▓▓▓│  
 . │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓│ │▓▓▓││▓▓▓▓│ │▓▓▓│ │▓▓▓│ 
│▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒│ │▒▒▒││▒▒▒▒│ . │▒▒▒│ . │▒▒▒│ . 
 │▒▒▒▓▓▓▓▒▒▒▓▓▓▓▒▒▒▓▓▓▓▓▒▒▒▓▓│▒▒▒│ │▒▒▒│ │▒▒▒▒│ │▒▒▒│ │▒▒▒│  
 │▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒▒▓▓▓▓█│▒▒▒└─┐┌──┘▒▒▒▒└──┐ │▒▒▒│ │▒▒▒│  
 ▓░░░░░░░░░░ ░░░░░░░░░░░░░░░░░▒▒▒▒▓▓░░░░░▓▓░░░░░░░░░░│ │░░░│ │░░░│  
 ▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒░░░│ │░░░│  
 ▓▒░░░░░░░░░░▓▓▓▓░░░▓▓▓▓▓░░░▓▓▓░░░░░░░▒▒░░░░░▒▒░░░░░░░░░░▓▓▓▓░░░│ │░░░│  
 ▓▒▒░▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▓
 ▓▒░░▒▒▓▓▓▓███████__̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡̡.___█████████████░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▓▒░░▒▒▓▓██████████ Welcome to the Varia House. ██████████████▒▒▒▒▒▒▒▒▒▒░░░░░░░░░
▒░░███████████████ CRUNK ████████████████▓▓▓▓▓▓▓▓▓▓▓▓░░░░░
 ░███████████████████████████████████████████████████████████████████████▓▓▓▓▓░░
Loading…
Cancel
Save