From 8b49d564abbc6f59f096c72bcd3b172239821b13 Mon Sep 17 00:00:00 2001 From: User <> Date: Sat, 23 Sep 2017 16:23:27 +0200 Subject: [PATCH] rename project, add resource relocation script, add level json --- Configs/Default.config.gmx | 54 ++++++------ FixProjectDirectories.py | 44 ++++++++++ Project3.project.gmx => TypeGraph.project.gmx | 73 ++++++++++++++-- datafiles/levels/01-intro.json | 47 +++++++++++ datafiles/levels/02-function.json | 60 ++++++++++++++ datafiles/levels/10-pure.json | 83 +++++++++++++++++++ rooms/roomInit.room.gmx | 16 ++-- rooms/roomLevelEditor.room.gmx | 63 ++++++++++++++ rooms/roomMenu.room.gmx | 16 ++-- 9 files changed, 404 insertions(+), 52 deletions(-) create mode 100644 FixProjectDirectories.py rename Project3.project.gmx => TypeGraph.project.gmx (80%) create mode 100644 datafiles/levels/01-intro.json create mode 100644 datafiles/levels/02-function.json create mode 100644 datafiles/levels/10-pure.json create mode 100644 rooms/roomLevelEditor.room.gmx diff --git a/Configs/Default.config.gmx b/Configs/Default.config.gmx index 1b66f10..41ec0e1 100644 --- a/Configs/Default.config.gmx +++ b/Configs/Default.config.gmx @@ -204,14 +204,14 @@ false True 1 - + Flumble nil False false false true 0 - GameMaker: Studio + Type Graph True 0 @@ -343,28 +343,28 @@ 255 nil false - + Puzzle Games : public.app-category.puzzle-games 0 0 0 - (c)2016 CompanyName Ltd... + CC BY-NC-SA -1 - Project3 - 0 + Type Graph + -1 0 0 Configs\Default\mac\icon512.png - -1 - 1 + 0 + 0 0 - 0 - ~/GameMaker-Studio/Project3 - -1 + 1 + ~/GameMaker-Studio/TypeGraph + 0 -1 -1 Developer ID Application: - 0 + -1 Configs\Default\mac\splash.png 0 0 @@ -467,13 +467,13 @@ False True False - 100 + 1 0 - + CC BY-NC-SA - 1 - 0 + 0 + 1 0 @@ -485,27 +485,27 @@ 0 Windows8_TemporaryKey.pfx - Project3 + Type Graph 0 - -1 + 0 -1 -1 Configs\Default\Windows8\logos\logo150.png #000000 light - 1 + 0 0 - 0 + 1 Win8NativeRunner_TemporaryKey.pfx x86 - YourPackageDisplayName - YourPackageName + + TypeGraph -1 -1 - YourPublisherName + CN=YoyoGames 0 - false + true 0 Configs\Default\Windows8\logos\logo30.png #000000 @@ -550,14 +550,14 @@ False 0 - + CC BY-NC-SA False 0 Configs\Default\windows\runner_icon.ico Configs\Default\windows\License.txt - 0 - 1 + 1 + 0 Configs\Default\windows\RunnerInstaller.nsi 0 diff --git a/FixProjectDirectories.py b/FixProjectDirectories.py new file mode 100644 index 0000000..e3f2a08 --- /dev/null +++ b/FixProjectDirectories.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +"""Python script to fix a GMS1.4 project with subfolders""" +import sys +from xml.etree import ElementTree +from pathlib import Path +from os import replace, mkdir + +cwd = Path.cwd() +projectFile = cwd / (cwd.stem + ".project.gmx") + +def moveResources(elementTree, directory, dname, resourceType, fileSuffix): + for entry in elementTree.findall(resourceType): + resName = Path(entry.text).name + filename = resName + fileSuffix + old = cwd / (resourceType+"s") / filename + new = directory / old.name + if Path.exists(old): + replace(old, new) + if resourceType == "sprite": + for frame in ElementTree.parse(new).findall(".//frame"): + oldImg = cwd / (resourceType+"s") / frame.text + newImg = directory / frame.text + if not Path.exists(newImg.parent): + mkdir(newImg.parent) + if Path.exists(oldImg): + replace(oldImg, newImg) + entry.text = dname + "\\" + resName + + for group in elementTree.findall(resourceType+"s"): + name = group.get("name") + newDir = directory / name + subname = name if dname == "" else dname+"\\"+name + if not Path.exists(newDir): + mkdir(newDir) + moveResources(group, newDir, subname, resourceType, fileSuffix) + + +project = ElementTree.parse(projectFile) +root = project.getroot() + +for (res, suffix) in [("background", ".background.gmx"), ("object", ".object.gmx"), ("path", ".path.gmx"), ("room", ".room.gmx"), ("script", ""), ("shader", ".shader.gmx"), ("sound", ".sound.gmx"), ("sprite", ".sprite.gmx")]: + moveResources(root, cwd, "", res, suffix) + +project.write(projectFile) diff --git a/Project3.project.gmx b/TypeGraph.project.gmx similarity index 80% rename from Project3.project.gmx rename to TypeGraph.project.gmx index 7a01643..cfdee39 100644 --- a/Project3.project.gmx +++ b/TypeGraph.project.gmx @@ -1,13 +1,67 @@ - Configs\Default - - + + + + 01-intro.json + -1 + 539 + 2 + + 0 + -1 + 0 + 0 + + + 9223372036854775807 + + + 01-intro.json + + + 02-function.json + -1 + 731 + 2 + + 0 + -1 + 0 + 0 + + + 9223372036854775807 + + + 02-function.json + + + 10-pure.json + -1 + 1013 + 2 + + 0 + -1 + 0 + 0 + + + 9223372036854775807 + + + 10-pure.json + + + + + sprites\pixel - + sprites\placeholder\placeholder sprites\placeholder\placeholderBlock sprites\placeholder\placeholderBlockX @@ -26,12 +80,12 @@ sprites\placeholder\placeholderPane sprites\placeholder\placeholderOneUse - + sprites\mask\maskConnection - - + + @@ -171,13 +225,14 @@ rooms\roomInit rooms\roomMenu rooms\room0 + rooms\roomLevelEditor help.rtf 0 - + 0 - + \ No newline at end of file diff --git a/datafiles/levels/01-intro.json b/datafiles/levels/01-intro.json new file mode 100644 index 0000000..a6df21a --- /dev/null +++ b/datafiles/levels/01-intro.json @@ -0,0 +1,47 @@ +{ + "traits": [], + "parameters": [ + { + "name": "0", + "free": false, + "order": 0, + "traits": [] + }, + { + "name": "1", + "free": false, + "order": 0, + "traits": [] + } + ], + "blocks": [ + { + "count": 1, + "name": "0", + "in": [ + { + "parameter": "0", + "children": [] + } + ], + "out": [ + { + "parameter": "1", + "children": [] + } + ] + } + ], + "start": [ + { + "parameter": "0", + "children": [] + } + ], + "goal": [ + { + "parameter": "1", + "children": [] + } + ] +} \ No newline at end of file diff --git a/datafiles/levels/02-function.json b/datafiles/levels/02-function.json new file mode 100644 index 0000000..ea4b575 --- /dev/null +++ b/datafiles/levels/02-function.json @@ -0,0 +1,60 @@ +{ + "traits": [], + "parameters": [ + { + "name": "0", + "free": false, + "order": 0, + "traits": [] + }, + { + "name": "1", + "free": false, + "order": 0, + "traits": [] + }, + { + "name": "2", + "free": false, + "order": 0, + "traits": [] + } + ], + "blocks": [ + { + "count": 1, + "in": [ + { + "parameter": "0", + "children": [] + }, + { + "parameter": "1", + "children": [] + } + ], + "out": [ + { + "parameter": "2", + "children": [] + } + ] + } + ], + "start": [ + { + "parameter": "0", + "children": [] + }, + { + "parameter": "0", + "children": [] + } + ], + "goal": [ + { + "parameter": "2", + "children": [] + } + ] +} \ No newline at end of file diff --git a/datafiles/levels/10-pure.json b/datafiles/levels/10-pure.json new file mode 100644 index 0000000..201ca08 --- /dev/null +++ b/datafiles/levels/10-pure.json @@ -0,0 +1,83 @@ +{ + "traits": [ + { + "name": "functor", + "parents": [] + }, + { + "name": "applicative", + "parents": [ + "functor" + ] + } + ], + "parameters": [ + { + "name": "0", + "free": true, + "order": 0, + "traits": [] + }, + { + "name": "1", + "free": true, + "order": 1, + "traits": [ + "applicative" + ] + }, + { + "name": "2", + "free": false, + "order": 0, + "traits": [] + }, + { + "name": "3", + "free": false, + "order": 1, + "traits": [ + "applicative" + ] + } + ], + "blocks": [ + { + "count": 1, + "in": [ + { + "parameter": "0", + "children": [] + } + ], + "out": [ + { + "parameter": "1", + "children": [ + { + "parameter": "0", + "children": [] + } + ] + } + ] + } + ], + "start": [ + { + "parameter": "2", + "children": [] + } + ], + "goal": [ + { + "parameter": "3", + "children": [ + { + "parameter": "2", + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/rooms/roomInit.room.gmx b/rooms/roomInit.room.gmx index df22c0b..0c8b3f4 100644 --- a/rooms/roomInit.room.gmx +++ b/rooms/roomInit.room.gmx @@ -41,14 +41,14 @@ - - - - - - - - + + + + + + + + diff --git a/rooms/roomLevelEditor.room.gmx b/rooms/roomLevelEditor.room.gmx new file mode 100644 index 0000000..ed49ef3 --- /dev/null +++ b/rooms/roomLevelEditor.room.gmx @@ -0,0 +1,63 @@ + + + + 4000 + 4000 + 32 + 32 + 0 + 1000 + 0 + 12632256 + -1 + + -1 + -1 + -1 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 0 + 1024 + 768 + 0 + 10 + 0.100000001490116 + diff --git a/rooms/roomMenu.room.gmx b/rooms/roomMenu.room.gmx index 7f49632..b468235 100644 --- a/rooms/roomMenu.room.gmx +++ b/rooms/roomMenu.room.gmx @@ -41,14 +41,14 @@ - - - - - - - - + + + + + + + +