Untitled

 avatar
unknown
plain_text
a month ago
3.1 kB
3
Indexable
import pygame
import os, sys, time



#Initializes the screen - Careful: all pygame commands must come after the init
pygame.init()
clock = pygame.time.Clock()

#Sets mouse cursor visibility
pygame.mouse.set_visible(False)

width, height = 800, 600
COLOR_WHITE = (255, 255, 255)
COLOR_GREEN = (0,255,0)
COLOR_BLACK = (13,13,13)
screen = pygame.display.set_mode((width, height), pygame.FULLSCREEN)


class Board(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.Surface((width, height))
        self.image.fill(COLOR_BLACK)
        self.image.set_colorkey(COLOR_BLACK)
        self.rect = self.image.get_rect()
        self.font = pygame.font.SysFont("monospace", 18)

    def add(self, letter, pos):
        s = self.font.render(letter, 1, COLOR_WHITE)
        self.image.blit(s, pos)

class Cursor(pygame.sprite.Sprite):
    def __init__(self, board):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.Surface((10, 20))
        self.image.fill(COLOR_GREEN)
        self.text_height = 17
        self.text_width = 10
        self.rect = self.image.get_rect(topleft=(self.text_width, self.text_height))
        self.board = board
        self.text = ''
        self.cooldown = 0
        self.cooldowns = {'.': 12,
                        '*': 300,
                        '[': 18,
                        ']': 18,
                        ' ': 5,
                        '\n': 30}
        self.firstrun = True

    def write(self, text):
        self.text = list(text)

    def update(self):
        if self.firstrun:
            self.firstrun = False
            time.sleep(6) 
        if not self.cooldown and self.text:
            letter = self.text.pop(0)
            if letter == '\n':
                self.rect.move_ip((0, self.text_height))
                self.rect.x = self.text_width
            else:
                self.board.add(letter, self.rect.topleft)
                self.rect.move_ip((self.text_width, 0))
            self.cooldown = self.cooldowns.get(letter, 8)

        if self.cooldown:
            self.cooldown -= 1

all_sprites = pygame.sprite.Group()
board = Board()
cursor = Cursor(board)
all_sprites.add(cursor, board)

text = """[i] Initializing Phish.AI...
[i] Loading ...

Hey Nathan... You almost gave a creepy Phishing site your LinkedIn password ... *
Why are your lights off? ... Let me get that for you ... *
Look, You and LinkedIn don't have to deal with these sites anymore... *
It is 2025, let A.I handle these creeps, and you or your members will never see them again! ... *
Let me show you ... *

"""

cursor.write(text)

#Main loop
running = True
while running:

    for e in pygame.event.get():
        if e.type == pygame.QUIT:
            running = False
        if e.type == pygame.KEYDOWN:
            if e.key == pygame.K_ESCAPE:
                running = False

    all_sprites.update()
    screen.fill((0, 0, 0))
    all_sprites.draw(screen)
    pygame.display.flip()
    clock.tick(60)
sys.exit(0)
Leave a Comment