Compare commits

...

3 Commits

Author SHA1 Message Date
848ad2f8ff Started work on game 2025-06-22 20:01:13 +01:00
5101ec3eef Added fonts 2025-06-22 18:56:33 +01:00
f5314d86e3 Updated to use v1.1.0 of BaseGame and v1.0.0 of GameUtils 2025-06-22 18:49:32 +01:00
13 changed files with 63 additions and 5 deletions

BIN
fonts/Chernobyl.otf Normal file

Binary file not shown.

BIN
fonts/CloisterBlack.ttf Normal file

Binary file not shown.

Binary file not shown.

BIN
fonts/Flame on Black.ttf Normal file

Binary file not shown.

BIN
fonts/LEDLIGHT.otf Normal file

Binary file not shown.

BIN
fonts/Noxlock-Free.otf Normal file

Binary file not shown.

BIN
fonts/RoyalInitialen.ttf Normal file

Binary file not shown.

BIN
fonts/VIDEO PIRATE.ttf Normal file

Binary file not shown.

BIN
fonts/Vampire Wars.ttf Normal file

Binary file not shown.

16
fonts/fonts.json Normal file
View File

@ -0,0 +1,16 @@
[
{"file": "Noxlock-Free.otf", "alphabet": "abcdefghijklmnopqrstuvwxyz", "dificulty": 0.0},
{"file": "Chernobyl.otf", "alphabet": "abcdefghijklmnopqrstuvwxyz0123456789", "dificulty": 0.1},
{"file": "VIDEO PIRATE.ttf", "alphabet": "abcdefghijklmnopqrstuvwxyz", "dificulty": 0.1},
{"file": "Vampire Wars.ttf", "alphabet": "abcdefghijklmnopqrstuvwxyz0123456789", "dificulty": 0.1},
{"file": "CloisterBlack.ttf", "alphabet": "0123456789", "dificulty": 0.1},
{"file": "Noxlock-Free.otf", "alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "dificulty": 0.2},
{"file": "CloisterBlack.ttf", "alphabet": "abcdefghijklmnopqrstuvwxyz", "dificulty": 0.3},
{"file": "LEDLIGHT.otf", "alphabet": "abcdefghijklmnopqrstuvwxyz", "dificulty": 0.4},
{"file": "Flame on Black", "alphabet": "abcdefghijklmnopqrstuvwxyz0123456789!?/#<>", "dificulty": 0.5},
{"file": "CloisterBlack.ttf", "alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "dificulty": 0.6},
{"file": "mevno2.ttf", "alphabet": "abcdefghijklmnopqrstuvwxyz", "dificulty": 0.8},
{"file": "CloisterBlack.ttf", "alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "dificulty": 0.8},
{"file": "RoyalInitialen.ttf", "alphabet": "abcdefghijklmnopqrstuvwxyz", "dificulty": 0.8},
{"file": "DeathMohawk_PERSONAL_USE_ONLY.otf", "alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "dificulty": 1.0}
]

BIN
fonts/mevno2.ttf Normal file

Binary file not shown.

49
game.py
View File

@ -1,8 +1,21 @@
from PIL import Imgae from PIL import Image
import logging import logging
import pygame import pygame
import gameUtils import gameUtils
import NoPELib import NoPELib
import random
import json
def normalDist(difficulty):
# Create a random number between 0-1
v = random.randint(-1000, 1000) / 1000
# Redistribute the number
v = v**3
# Shift the number based on game difficulty
difficulty = difficulty * 1.5 - 0.25
v += difficulty
# Cap it to be 0-1 again and return
return min(max(v, 0), 1)
class Game(gameUtils.Game): class Game(gameUtils.Game):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -18,6 +31,24 @@ class Game(gameUtils.Game):
# Don't remove this. It does important things. :3 # Don't remove this. It does important things. :3
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
# A value between 0-1 that defines which fonts the game will use
self.gameDifficulty = 0
# The actual text in the captcha, used to check what the user typed
self.currentCaptchaText = ''
# The image of the captcha
self.currentCaptchaImg = ''
self.fonts = {}
with open(f'./fonts/fonts.json', 'r') as f:
j = json.loads(f.read())
#for fontData in j:
# self.fonts.update()
def createCaptcha(self):
pass
def onEvent(self, event): def onEvent(self, event):
""" """
Ran when an event is fired. Ran when an event is fired.
@ -25,18 +56,28 @@ class Game(gameUtils.Game):
Args: Args:
event (pygame.Event): The event that was fired. event (pygame.Event): The event that was fired.
""" """
pass if event.type == pygame.KEYDOWN:
if event.key == pygame.K_1:
self.gameDifficulty -= 0.1
elif event.key == pygame.K_2:
self.gameDifficulty += 0.1
elif event.key == pygame.K_3:
self.createCaptcha()
print(self.gameDifficulty)
def update(self): def update(self):
""" """
Ran once per frame, put your drawing code and any Ran once per frame, put your drawing code and any
game logic that should be ran once per frame in here. game logic that should be ran once per frame in here.
""" """
pass
# Don't remove this. It does important things. :3
super().update()
self.surf.fill((0, 0, 0))
def close(self): def close(self):
""" """
Ran when the game closes. Ran when the game closes.
""" """
pass pass

View File

@ -1,4 +1,5 @@
../GameUtils/ ../GameUtils/
../NoPELib/ ../NoPELib/
../PDOLib/ ../PDOLib/
pygame-ce pygame-ce
Pillow