mirror of
https://git.astronand.dev/minecartchris/Stock-Game.git
synced 2026-06-10 21:57:26 -04:00
Add initial implementation of Stock Trading Game with CSS styling, HTML structure, and trade logging functionality
This commit is contained in:
57
Jan IT-Club Thing/dvd.py
Normal file
57
Jan IT-Club Thing/dvd.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import pygame
|
||||
import random
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
pygame.init()
|
||||
screen = pygame.display.set_mode((1920, 1080))
|
||||
pygame.display.set_caption("Simple Pygame Example")
|
||||
clock = pygame.time.Clock()
|
||||
font = pygame.font.SysFont(None, 55)
|
||||
WHITE = (255, 255, 255)
|
||||
|
||||
x = 20
|
||||
y = 20
|
||||
xbool = False
|
||||
ybool = False
|
||||
|
||||
toWrite = "Drugs"
|
||||
|
||||
while True:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
|
||||
screen.fill((0, 0, 0))
|
||||
text = font.render(toWrite, True, WHITE)
|
||||
screen.blit(text, (x, y))
|
||||
|
||||
text_width, text_height = font.size(toWrite)
|
||||
|
||||
pygame.display.flip()
|
||||
clock.tick(60)
|
||||
if x > (screen.get_width() - text_width) or xbool:
|
||||
x = x - 1
|
||||
xbool = True
|
||||
else:
|
||||
x = x + 1
|
||||
xbool = False
|
||||
|
||||
|
||||
if y > (screen.get_height() - text_height) or ybool:
|
||||
y = y - 1
|
||||
ybool = True
|
||||
else:
|
||||
y = y + 1
|
||||
ybool = False
|
||||
|
||||
if y < 0:
|
||||
y = 0
|
||||
ybool = False
|
||||
if x < 0:
|
||||
x = 0
|
||||
xbool = False
|
||||
print(x, y)
|
||||
time.sleep(0.01)
|
||||
Reference in New Issue
Block a user