45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
"""
|
|
#File Name: settings.py
|
|
|
|
Global settings and imports for the project.
|
|
|
|
This module defines various settings for the game engine, such as enabling or disabling the cursor, glow effect, gas effect, debug mode, and FPS display. It also provides a function to load particle properties from a JSON file.
|
|
|
|
The `engine_settings` dictionary contains the configurable settings for the game engine. These settings can be used to customize the behavior of the game.
|
|
|
|
The `load_particle_properties()` function attempts to load particle properties from a 'particles.json' file. If the file is not found or the JSON data is invalid, it returns an empty dictionary.
|
|
|
|
The `particle_properties` variable is initialized by calling `load_particle_properties()` when the module is imported.
|
|
"""
|
|
|
|
|
|
import pygame
|
|
import json
|
|
import random
|
|
import numpy as np
|
|
|
|
engine_settings = {
|
|
'enable_cursor': True,
|
|
'enable_glow': False,
|
|
'enable_gas_effect': True,
|
|
'enable_debug': False,
|
|
'enable_fps': True,
|
|
'enable_WVisuals': False,
|
|
'enable_PVisuals': False,
|
|
'enable_TempVisuals': False,
|
|
# 'settings': True/False
|
|
}
|
|
|
|
# Load particle properties from JSON file
|
|
def load_particle_properties():
|
|
try:
|
|
with open('particles.json') as f:
|
|
return json.load(f)
|
|
except (FileNotFoundError, json.JSONDecodeError):
|
|
print("Error loading particles.json")
|
|
return {}
|
|
|
|
# Load particle properties once when module is imported
|
|
particle_properties = load_particle_properties()
|
|
|