Initial version

This commit is contained in:
csd4ni3l
2025-06-10 11:05:55 +02:00
commit 333a4e307e
27 changed files with 1880 additions and 0 deletions

38
utils/constants.py Normal file
View File

@@ -0,0 +1,38 @@
min_enemy_y = 9
max_enemy_y = 16
min_enemy_movement = 7
max_enemy_movement = 10
min_enemy_speed = 0.08
max_enemy_speed = 0.12
enemy_health = 100
weapons = {
"assault_rifle": {"dmg": 20, "atk_speed": 0.2, "image": "assets/graphics/assaultrifle.png"},
"smg": {"dmg": 10, "atk_speed": 0.1, "image": "assets/graphics/smg.png"},
"pistol": {"dmg": 100 / 3, "atk_speed": 1 / 3, "image": "assets/graphics/pistol.png"},
"revolver": {"dmg": 50, "atk_speed": 1 / 2, "image": "assets/graphics/revolver.png"},
"sniper": {"dmg": 100, "atk_speed": 1, "image": "assets/graphics/sniper.png"},
}
discord_presence_id = 1380237183352311838
settings = {
"Graphics": {
"Window Mode": {"type": "option", "options": ["Windowed", "Fullscreen", "Borderless"], "config_key": "window_mode", "default": "Windowed"},
"Resolution": {"type": "option", "options": ["1366x768", "1440x900", "1600x900", "1920x1080", "2560x1440", "3840x2160"], "config_key": "resolution"},
"Anti-Aliasing": {"type": "option", "options": ["None", "2x MSAA", "4x MSAA", "8x MSAA", "16x MSAA"], "config_key": "anti_aliasing", "default": "4x MSAA"},
"VSync": {"type": "bool", "config_key": "vsync", "default": True},
},
"Sound": {
"Music": {"type": "bool", "config_key": "music", "default": True},
"SFX": {"type": "bool", "config_key": "sfx", "default": True},
"Music Volume": {"type": "slider", "min": 0, "max": 100, "config_key": "music_volume", "default": 50},
"SFX Volume": {"type": "slider", "min": 0, "max": 100, "config_key": "sfx_volume", "default": 50},
},
"Miscellaneous": {
"Discord RPC": {"type": "bool", "config_key": "discord_rpc", "default": True},
},
"Credits": {}
}
settings_start_category = "Graphics"

4
utils/preload.py Normal file
View File

@@ -0,0 +1,4 @@
from ursina import Audio
music_sound = Audio("assets/sound/music.mp3", autoplay=False)
death_sound = Audio("assets/sound/death.mp3", autoplay=False)

33
utils/utils.py Normal file
View File

@@ -0,0 +1,33 @@
from panda3d.core import GraphicsPipeSelection
def get_closest_resolution():
allowed_resolutions = [(1366, 768), (1440, 900), (1600,900), (1920,1080), (2560,1440), (3840,2160)]
pipe = GraphicsPipeSelection.getGlobalPtr().makeDefaultPipe()
if not pipe:
screen_width, screen_height = min(allowed_resolutions, key=lambda res: res[0] * res[1])
else:
screen_width = pipe.getDisplayWidth()
screen_height = pipe.getDisplayHeight()
if (screen_width, screen_height) in allowed_resolutions:
if not allowed_resolutions.index((screen_width, screen_height)) == 0:
closest_resolution = allowed_resolutions[allowed_resolutions.index((screen_width, screen_height))-1]
else:
closest_resolution = (screen_width, screen_height)
else:
target_width, target_height = screen_width // 2, screen_height // 2
closest_resolution = min(
allowed_resolutions,
key=lambda res: abs(res[0] - target_width) + abs(res[1] - target_height)
)
return closest_resolution
class FakePyPresence():
def __init__(self):
...
def update(self, *args, **kwargs):
...
def close(self, *args, **kwargs):
...