-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlil test script.py
More file actions
62 lines (44 loc) · 1.53 KB
/
Copy pathlil test script.py
File metadata and controls
62 lines (44 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from clrprint import *
import pygame
ascii_colors = [0,"red", "yellow", "green", "blue", "purple", "pink" ]
def cycle_list(input_list):
for i in range(len(input_list)):
try:
input_list[i] = input_list[i+1]
except IndexError:
input_list[i] = input_list[0]
break
def rainbow_print(text):
text_split = list(text)
for i in range(len(text)):
cycle_list(ascii_colors)
clrprint(text_split[i], clr= ascii_colors[0],end='')
def rainbow_print_anim(text):
text_split = list(text)
for i in range(len(text)):
cycle_list(ascii_colors)
clrprint(text_split[i], clr= ascii_colors[0],end='')
#Initialize Pygame, screen, and clock
pygame.init()
screen_width = 64
screen_height = 64
screen = pygame.display.set_mode((screen_width, screen_height), pygame.RESIZABLE)
FPS = 60
clock = pygame.time.Clock()
cycle_loop = True
print(list(range(ord('a'), ord('z') + 1)))
#Game engine loop
while cycle_loop:
for event in pygame.event.get():
#Keyboard triggers
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
cycle_loop = not cycle
if event.key == pygame.K_SPACE:
rainbow_print("hi I'm Kate ")
#Resize screen
if event.type == pygame.VIDEORESIZE:
screen_width, screen_height = event.w, event.h
screen = pygame.display.set_mode((screen_width, screen_height), pygame.RESIZABLE)
clock.tick(FPS)
pygame.display.flip()