From 188494bb254fd41c6493b4642c91897a0aad941b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Sat, 18 May 2024 18:16:15 +0500 Subject: [PATCH] Add a new level. --- games/strangeroom/__init__.py | 17 +++ games/strangeroom/strangeroom.json | 195 +++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 games/strangeroom/__init__.py create mode 100644 games/strangeroom/strangeroom.json diff --git a/games/strangeroom/__init__.py b/games/strangeroom/__init__.py new file mode 100644 index 0000000..f7b00ec --- /dev/null +++ b/games/strangeroom/__init__.py @@ -0,0 +1,17 @@ +import importlib.resources as impr +import sys +import json +import serialize +from engineevents import EngineEvent + +def init(aoEngineEvents): + curm = sys.modules[__name__] + files = impr.files(curm) + level = None + with files.joinpath("strangeroom.json").open('r') as leveldir: + level = json.loads(leveldir.read(), object_hook=serialize.object_hook) + aoEngineEvents.append(EngineEvent( + 'level', + lambda _: level, + tsArguments=() + )) diff --git a/games/strangeroom/strangeroom.json b/games/strangeroom/strangeroom.json new file mode 100644 index 0000000..a1ae4d0 --- /dev/null +++ b/games/strangeroom/strangeroom.json @@ -0,0 +1,195 @@ +[ + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": -0.1335, + "imag": -0.145 + }, + "pointB": { + "__type__": "complex", + "real": -0.2085, + "imag": 0.1675 + }, + "color": [ + 128, + 128, + 128 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": 0.214, + "imag": 0.1875 + }, + "pointB": { + "__type__": "complex", + "real": -0.208, + "imag": 0.1675 + }, + "color": [ + 128, + 128, + 128 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": 0.214, + "imag": 0.1875 + }, + "pointB": { + "__type__": "complex", + "real": 0.144, + "imag": -0.185 + }, + "color": [ + 128, + 128, + 128 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": -0.1335, + "imag": -0.145 + }, + "pointB": { + "__type__": "complex", + "real": 0.144, + "imag": -0.185 + }, + "color": [ + 128, + 128, + 128 + ] + }, + + + + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": -0.562, + "imag": -0.555 + }, + "pointB": { + "__type__": "complex", + "real": -0.682, + "imag": 0.400 + }, + "color": [ + 200, + 200, + 200 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": -0.062, + "imag": 0.790 + }, + "pointB": { + "__type__": "complex", + "real": -0.682, + "imag": 0.400 + }, + "color": [ + 200, + 200, + 200 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": -0.062, + "imag": 0.790 + }, + "pointB": { + "__type__": "complex", + "real": 0.583, + "imag": 0.540 + }, + "color": [ + 200, + 200, + 200 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": 0.793, + "imag": -0.085 + }, + "pointB": { + "__type__": "complex", + "real": 0.583, + "imag": 0.540 + }, + "color": [ + 200, + 200, + 200 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": 0.793, + "imag": -0.085 + }, + "pointB": { + "__type__": "complex", + "real": 0.333, + "imag": -0.720 + }, + "color": [ + 200, + 200, + 200 + ] + }, + { + "__type__": "objSegment", + "isFinite": true, + "pointA": { + "__type__": "complex", + "real": -0.547, + "imag": -0.550 + }, + "pointB": { + "__type__": "complex", + "real": -0.562, + "imag": -0.555 + }, + "color": [ + 200, + 200, + 200 + ] + } +]