mirror of
https://github.com/csd4ni3l/chaos-protocol.git
synced 2026-01-01 04:23:43 +01:00
Add settings for default values instead of constants, remove sfx from settings, add music, add missing collision event, remove 1366x768 as an allowed resolution
This commit is contained in:
@@ -7,12 +7,6 @@ LOGICAL_OPERATORS = ["and", "or"]
|
||||
SHAPES = ["rectangle", "circle", "triangle"]
|
||||
VAR_NAMES = ["a", "b", "c", "d", "e", "f", "g"]
|
||||
|
||||
DEFAULT_X_GRAVITY = 0
|
||||
DEFAULT_Y_GRAVITY = 2
|
||||
|
||||
DEFAULT_X_VELOCITY = 0
|
||||
DEFAULT_Y_VELOCITY = 0
|
||||
|
||||
ALLOWED_INPUT = ["a", "b", "c", "d", "e", "q", "w", "s", "t"]
|
||||
|
||||
COLORS = [
|
||||
@@ -82,7 +76,7 @@ IF_RULES = {
|
||||
"spawns": {
|
||||
"key": "spawns",
|
||||
"description": "IF {a} shape spawns",
|
||||
"trigger": "spawns",
|
||||
"trigger": "spawn",
|
||||
"user_vars": ["shape_type"],
|
||||
"vars": ["shape_type", "event_shape_type"],
|
||||
"func": lambda *v: v[0] == v[1]
|
||||
@@ -111,22 +105,6 @@ IF_RULES = {
|
||||
"vars": ["shape_type", "event_shape_type"],
|
||||
"func": lambda *v: v[0] == v[1]
|
||||
},
|
||||
"x_gravity_changes": {
|
||||
"key": "x_gravity_changes",
|
||||
"description": "IF {a} shape X gravity changes",
|
||||
"trigger": "gravity_x_change",
|
||||
"user_vars": ["shape_type"],
|
||||
"vars": ["shape_type", "event_shape_type"],
|
||||
"func": lambda *v: v[0] == v[1]
|
||||
},
|
||||
"y_gravity_changes": {
|
||||
"key": "y_gravity_changes",
|
||||
"description": "IF {a} shape Y gravity changes",
|
||||
"trigger": "gravity_y_change",
|
||||
"user_vars": ["shape_type"],
|
||||
"vars": ["shape_type", "event_shape_type"],
|
||||
"func": lambda *v: v[0] == v[1]
|
||||
},
|
||||
"color_changes": {
|
||||
"key": "color_changes",
|
||||
"description": "IF {a} shape color changes",
|
||||
@@ -438,16 +416,21 @@ slider_style = {'normal': slider_default_style, 'hover': slider_hover_style, 'pr
|
||||
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"},
|
||||
"Resolution": {"type": "option", "options": ["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},
|
||||
"FPS Limit": {"type": "slider", "min": 0, "max": 480, "config_key": "fps_limit", "default": 60},
|
||||
},
|
||||
"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},
|
||||
},
|
||||
"Game": {
|
||||
"Default X velocity": {"type": "slider", "min": -999, "max": 999, "config_key": "default_x_velocity", "default": 0},
|
||||
"Default Y velocity": {"type": "slider", "min": -999, "max": 999, "config_key": "default_y_velocity", "default": 0},
|
||||
"Default X gravity": {"type": "slider", "min": -999, "max": 999, "config_key": "default_x_gravity", "default": 0},
|
||||
"Default Y gravity": {"type": "slider", "min": -999, "max": 999, "config_key": "default_y_gravity", "default": 5},
|
||||
"Max Shapes": {"type": "slider", "min": 0, "max": 999, "config_key": "max_shapes", "default": 120},
|
||||
},
|
||||
"Miscellaneous": {
|
||||
"Discord RPC": {"type": "bool", "config_key": "discord_rpc", "default": True},
|
||||
|
||||
@@ -12,3 +12,5 @@ SPRITE_TEXTURES = {
|
||||
"rectangle": arcade.load_texture(os.path.join(_assets_dir, 'graphics', 'sprites', 'rectangle.png')),
|
||||
"triangle": arcade.load_texture(os.path.join(_assets_dir, 'graphics', 'sprites', 'triangle.png')),
|
||||
}
|
||||
|
||||
theme_sound = arcade.Sound(os.path.join(_assets_dir, 'sound', 'music.ogg'))
|
||||
@@ -41,7 +41,7 @@ def on_exception(*exc_info):
|
||||
logging.error(f"Unhandled exception:\n{''.join(traceback.format_exception(exc_info[1], limit=None))}")
|
||||
|
||||
def get_closest_resolution():
|
||||
allowed_resolutions = [(1366, 768), (1440, 900), (1600,900), (1920,1080), (2560,1440), (3840,2160)]
|
||||
allowed_resolutions = [(1440, 900), (1600,900), (1920,1080), (2560,1440), (3840,2160)]
|
||||
screen_width, screen_height = arcade.get_screens()[0].width, arcade.get_screens()[0].height
|
||||
if (screen_width, screen_height) in allowed_resolutions:
|
||||
if not allowed_resolutions.index((screen_width, screen_height)) == 0:
|
||||
|
||||
Reference in New Issue
Block a user