Start making this thing into an actual game engine.

This commit is contained in:
bʰedoh₂ swé 2024-04-07 01:38:06 +05:00
parent d28d1d10ed
commit d9ce3fd3ab
3 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,11 @@
import importlib.resources as impr
import sys
import json
def init(serialize):
curm = sys.modules[__name__]
files = impr.files(curm)
level = None
with files.joinpath("squareroom.json").open('r') as leveldir:
level = json.loads(leveldir.read(), object_hook=serialize.object_hook)
return level

View File

@ -0,0 +1 @@
[{"__type__": "objSegment", "isFinite": true, "pointA": {"__type__": "complex", "real": 0.6, "imag": 0.0}, "pointB": {"__type__": "complex", "real": 0.0, "imag": 0.6}, "color": [255, 0, 0]}, {"__type__": "objSegment", "isFinite": true, "pointA": {"__type__": "complex", "real": 0.6, "imag": 0.0}, "pointB": {"__type__": "complex", "real": 0.0, "imag": -0.6}, "color": [0, 255, 0]}, {"__type__": "objSegment", "isFinite": true, "pointA": {"__type__": "complex", "real": -0.6, "imag": 0.0}, "pointB": {"__type__": "complex", "real": 0.0, "imag": -0.6}, "color": [0, 0, 255]}, {"__type__": "objSegment", "isFinite": true, "pointA": {"__type__": "complex", "real": -0.6, "imag": 0.0}, "pointB": {"__type__": "complex", "real": 0.0, "imag": 0.6}, "color": [255, 255, 0]}]

View File

@ -11,6 +11,7 @@ from levels import open_level, save_level, make_wall
from constants import I, WHITE, BLACK, IROT, ROT, OFFSET
from draw import draw
from alert import Alert
from importlib import import_module
gOrigin = GyroVector(0,1)
@ -113,9 +114,11 @@ def mainLoop():
alert.start_hide_thread(alerts, delay)
try:
level = open_level(sys.argv[1])
game = import_module(sys.argv[1])
except IndexError:
level = open_level("maps/squareroom.json")
game = import_module("games.squareroom")
level = game.init(import_module('serialize'))
while bCont:
aoEngineEvents = fvControl_ao()