[Plugin] Isometric Z ordering based on Y

Forum Home Forum Home > Construct 2 Development > Plugins for Construct 2
 Post Reply Post Reply Page  12>
Author
2,959 Rep
Post Options Post Options   Quote juantar Quote  Post ReplyReply Direct Link To This Post Topic: [Plugin] Isometric Z ordering based on Y
    Posted: 17 Nov 2011 at 7:21pm
Update: The plugin is ready. You can download the ZSorter.zip file containing the plugin and the sample project test_iso.zip from:

http://sites.google.com/site/jptarqu/downloads

The plugin has one action ("Sort All Objects in Layer By Y") that you can call every tick. The action will sort all the objects of any kind in the layer that the ZSorter object is in. The objects are "Z sorted" by their Y position; if the Y positions is the same, they are sorted by their X position.

The sample project contains a layout with multiple objects being sorted in a layer. There is also a FPS count to determine how much impact the sorting has as the objects grow in number. I did not notice any impact in my system, but your mileage may vary. The sample also illustrates the technique of detecting collision with shadows instead of of the arpites themselves to allow sprites go "behind" a wall.The sample's walls are too small to notice the difference, but with if you are good at drawing you can make better walls and better shadows.

Please keep in mind that there is more to isometric games than sorting Z positions by Y. You need to take into account shadows (for collision detection), origin points (to allow players to walk behind walls, in the sample the Duck's origin is at the bottom and the wall's is at center) and more. Have fun!!


Thanks


Edited by juantar - 18 Nov 2011 at 11:38pm
Back to Top
16,726 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Posted: 17 Nov 2011 at 7:31pm
Nice idea.
Was hoping this would be doable in C2 if it ever got "for each ordered", like we have in CC.
One thing, even in CC each tick could get bogged down if you had a lot of instances, not sure it would be viable to use it that often in C2.
Back to Top
10,800 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 17 Nov 2011 at 11:43pm
Nice idea + 1

It seems to affect to all instances in a kind of sprite. Maybe it could be a "plugin" better than "behavior", I thought.
In this plugin, at start of layout, setup which kind of sprite will be sorted every tick. It could add some filters to select which instances to be sorted.


Edited by rexrainbow - 17 Nov 2011 at 11:45pm
Back to Top
2,959 Rep
Post Options Post Options   Quote juantar Quote  Post ReplyReply Direct Link To This Post Posted: 18 Nov 2011 at 11:36pm
OK, I released the plugin and sample and put the link in the original post.

Thanks!
Back to Top
3,661 Rep
Post Options Post Options   Quote plauk Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 12:07am
I'm not an expert, but I think you should change the 'type' to 'object' instead of 'world' in the edittime.js

That way it won't show up in the layout as if it were a visible item.

Edited by plauk - 19 Nov 2011 at 12:08am
Oh, look a breakout clone!
Back to Top
10,800 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 25 Dec 2011 at 2:44am
I check this plugin, and finally understand why ZSort is "world" type, not a "object" type.

It's because that ZSort need to get the layer parameter. If the plugin is "world" type, it must be put in a layer. So ZSort can sort this layer. On the other word, ZSort can not sort other layers.

If you like the ZSort with "object" type. You can try this. It need to indicate the layer number/name.
I change the icon and plugin id, too. The author is still juantar(Juan Pablo Tarquino).

Edited by rexrainbow - 25 Dec 2011 at 6:28am
Back to Top
2,959 Rep
Post Options Post Options   Quote juantar Quote  Post ReplyReply Direct Link To This Post Posted: 21 Jan 2012 at 11:23pm
Good job rexrainbow with the "object type" mod!

I have not have too much time to work on Construct, but I am glad the community is improving the plugin.

Like rexrainbow said, the world object allows you to ZSort only the layer that the ZSort object belongs too. All the other layers will not be touched.
Back to Top
3,660 Rep
Post Options Post Options   Quote Danijerry Quote  Post ReplyReply Direct Link To This Post Posted: 12 Feb 2012 at 4:33am
This plugin works great for me. I have several objects often swapping positions, this works seamlessly. Thanks for sharing.
Back to Top
10,800 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 26 Mar 2012 at 12:29am
Update:

rex_zSorter.7z

- add version to 1.0
- add custom sorting (sample)

Edited by rexrainbow - 26 Mar 2012 at 12:34am
Back to Top
10,312 Rep
Post Options Post Options   Quote TELLES0808 Quote  Post ReplyReply Direct Link To This Post Posted: 20 Apr 2012 at 6:29pm
Great solutions, I would like know if someday it become official, to be used on Arcade.

Thanks you for sharing your ideas, folks.
   
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down