[Request] Tiled BG w/ image offset

Post your work in progress addons and get feedback

Post » Fri Sep 06, 2013 11:51 pm

In Construct Classic, Tiled Background Objects had a feature called "Image Offset". This allowed you to shift the image in any direction without affecting the size of the object itself. It was ideal for tilesets, infinitely scrolling backgrounds, infinitely scrolling overlays, and quite a few other things.

I've tried to get this feature into C2's version multiple times but apparently it's very difficult to do with canvas2D (which no one should even be using) and Ashley won't release anything that's WebGL exclusive...except the whole pixel shader thing -w-;

Anyway, I *need* this feature to create a tile-based level editor utilizing external files. It's also much, MUCH better than using hundreds if not thousands of sprite frames acting as tiles for obvious reasons.

Is there anyone capable of & interested in creating an upgraded version of the Tiled BG object with this feature? If it's in the form of a shader I guess that'd work too.MadFactory2013-10-04 17:26:37
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Sat Sep 07, 2013 12:10 am

Tiled bg may not be able to show specific quadrants of a texture, but it can do something sprite can't, that being having different textures for different instances, loaded by url.

Imho that seems like a better option since you are not limited to a mapped tiled texture.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Sat Sep 07, 2013 12:39 am

Hm. My goal here is to allow teammates to add any tileset/background to the game & update them on the fly without SVN and a C2 license. Splitting them up into hundreds of little tile files doesn't seem like the best option. A list object will be populated with the names of tilesets in a dev folder, and then I go from there, shrinking the Tiled BGs to tile size and offsetting to the selected tile.

I'm open to other ideas but this seems the best to me.
MadFactory2013-09-07 00:40:43
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Sat Sep 07, 2013 1:11 am

Actually I've been thinking about making a tile editor, and one thing that you could do is use Rojo's Canvas plug to convert the textures into a string using Canvas.imageUrl.
Then you could save that data to an 3d array x, and y as position and a nested [email protected] for the image string and other data such as size and angle.

So in theory you could save every last bit of data into an array, and load that.

Just one file.newt2013-09-07 01:14:02
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Fri Oct 04, 2013 5:24 pm

Bump.

@Newt PM'edMadFactory2013-10-23 18:31:03
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Thu Oct 24, 2013 5:15 am

The process is pretty straight forward. For the editor you make a grid of canvas instances, then drag and drop the textures you want onto those instances. When you are ready to save you do a for each on the canvas's, and paste the texture into the canvas, and then get the base64 string, and save that to either one big string with tokenAt(), or use an array.

Then to load the textures, make a grid of tiled background instances, load the array, or string from the editor via the load array action, or from ajax.
You would then parse the array, or sting, with a for each in array, or for n = token count of the string.
Loading it from the string value as the load image from url action.

The string from the editor would be huge however, and you would want to do some optimizations like only saving one texture once.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Thu Oct 24, 2013 5:51 am

I see. I messed around with the canvas and sprite objects the other day.. Basically a resizable canvas can paste a tile or group from a single-image tileset, then load said image into a blank tile on the map. Worked pretty well but you could only paste as many images as there are animation frames and, as you said, those image URLs are massive.

I'll try your way and see what I can come up with.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Sat Oct 26, 2013 7:35 pm

@MadFactory
I just made a plugin that may be useful in this situation.
http://www.scirra.com/forum/topic78654_post466046.html#466046
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501


Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 2 guests