### Torque 2D Editor Work

2D version of the Torque engine.

Moderator: marauder2k9

#### Re: Torque 2D Editor Work

marauder2k9
Posts: 362
Joined: Wed Feb 18, 2015 7:36 am
Tonights video shows another addition, the collision shape editor loading collision shapes in for individual editing of restitution, density and friction.

Menu items are a little buggy because at the moment each rollout control is made on the fly and because it is collision shapes they need to be deleted and re-made each time a value is changed and so the menu is re-creating each input any time anything is changed. this isnt good i know but unfortunately its either this or creating the rollout menus before hand which means imposing a limit on the amount of collision shapes allowed.

#### Re: Torque 2D Editor Work

marauder2k9
Posts: 362
Joined: Wed Feb 18, 2015 7:36 am
Yo Dawg! I heard you like steering behaviours so i put some steering into your steering so you can steer lol

Edit: Updated video link to a new video with steering behaviours and rotation

#### Re: Torque 2D Editor Work

trident
Posts: 6
Joined: Wed Feb 18, 2015 11:58 pm
lol looks good trying to remember what game you had to control the ship like that

anyway well done

#### Re: Torque 2D Editor Work

marauder2k9
Posts: 362
Joined: Wed Feb 18, 2015 7:36 am
lol looks good trying to remember what game you had to control the ship like that

anyway well done
Damn uve made me wonder what that game is now too, was it an old dos game?

Anyway this steering behavior is all work towards an ai class

#### Re: Torque 2D Editor Work

marauder2k9
Posts: 362
Joined: Wed Feb 18, 2015 7:36 am
Okay so its been a couple of days since an update, bit off since ive been putting an update up here almost every day for the past week lol

What i am doing now:-

I think the most important thing at the moment is to be able to create modules inside the editor and to present the tools in a user-friendly way. Figuring out this loading and saving is becoming a bit of a challenge.

What is happening at the moment is every object added to the scene is put into its own simset, animations,sprites etc. Because the EditorToy is a module itself it looks for images in its own module. Loading another module inside the editortoy as far as i know is possible but at the moment because the objects are being created in one module and then added to a simset within that module, when it gets saved out and loaded back into the editor, the simset for the objects already exists and so it will not add them to it. Now i am working to fix this atm im almost certain its just a problem in my code.

But for exporting your projects and levels out i plan to do it the CS file route.

With the cs file route you can write out line by line the file that you want to put out. So for example if you have 10 sprites with a particular image asset, u you only have to have your constructor for that object in place once and have a create function in your reset script with different variables like so:
function MyToy::reset(%this)
{
%this.createBackground( static,10,10,1,1,1,31,"blue");
%this.createBackground( static,10,10,1,1,1,31,"red");
%this.createBackground( static,10,10,1,1,1,31,"green");
}

function MyToy::createBackground( %this, %bType, %posX, %posY, %sizeX, %sizeY,%pBool,%sLayer,%blndColor )
{
// Create the scroller.
%object = new Sprite();

// Set the sprite as "static" so it is not affected by gravity.
%object.setBodyType( %bType);

// Always try to configure a scene-object prior to adding it to a scene for best performance.

// Set the position.
%object.Position = %posX SPC %posY;

// Set the size.
%object.Size =%sizeX SPC %sizeY;
%object.PickingAllowed = %pBool;
// Set to the furthest background layer.
%object.SceneLayer = %sLayer;
// Set an image.
%object.Image = "ToyAssets:checkered";
// Set the blend color.
%object.BlendColor = %blndColor;
// Add the sprite to the scene.
SandboxScene.add( %object );
}

The above code is just an example for sprites using one imageasset. So if u have this sprite in your code 50 times it will create 50 create functions at the top to build the level. As far as i know this should be the best way to do it and it will mean an export with 20 lines of code for that 1 item instead of 1000 so if u do have to do any edits after export you wont have to delv through all that code to find the one object that isnt correct, you shouldn't have to do this anyway as long as you keep your modules save file, but for quick fixes sometimes we just like to jump into the script file and modify a single value while loading the module itself.

The old torque 2d (TGB) used to have different levels as different scenes and so this is the way i think i will do it with this editor too. Each level will be a different scene file that is loaded. This will in turn clear the previous scene removing it from memory and add another scene to the game that has function mentioned above added to it. Each scene will have its own settings too for camera size, gravity etc. each scene again will be saved as a taml file for the editor but exported as a cs file upon export for gameplay.

Each module will be saved for editing as a cs file, which will include a list of scenes which will in turn be linked to its respective objects taml files.

#### Re: Torque 2D Editor Work

marauder2k9
Posts: 362
Joined: Wed Feb 18, 2015 7:36 am
Very quick update:-

I have split up the assets that are currently working into their own scripts to allow space for working on module creation, loading and saving.

Once this is done scene saving and loading will be added.

So the order of operations required by the user will be:
Module->Scene->Assets

So a module needs to be defined, then a scene.

All assets imported after that will be assigned to that module and called by each scene as needed.

For clarification the start menu for your game will technically be a scene and atm you can place objects in a scene you will still have to go into script and modify them to load another scene. This will be sorted out later on but not when the initial module setup is released. I want people to be able to make scenes so that people can start using the editor asap and then sort out these features later on.

#### Re: Torque 2D Editor Work

marauder2k9
Posts: 362
Joined: Wed Feb 18, 2015 7:36 am
Update:-

Sorry it has been a few days since the last update, i know some people may assume a project is dead in here after a few days of silence and i apologize for that this project is not dead! and never will be.

So far i have modules working and scenes. I was hoping to have the editor set up so that assets are separate to their module rather than being global but this presents more problems with the file object. At the moment when a file object is loaded it is given a default folder location you can see this in action when u import an imageasset. If u load up an image asset from a certain folder in the editor as it is now it will start at the default folder for all modules then you can browse to a folder nearby for any image to be copied to the editor directory for use. Then when u load up a sprite it goes back to the folder that was last browsed to which shouldn't be happening it should be defaulting to the folder where the image assets were copied to. It seems to be loading up the same default location and settings from the previous FileDialogue. I am trying to figure it out hopefully will be sorted soon and then the module and scene creation can be released.

#### Who is online

Users browsing this forum: No registered users and 0 guests