[EFFECT] Flip Layout

Completed plugins, behaviors and effects.

Post » Fri Jun 01, 2012 10:38 pm

This effect flips a bunch of layers up to the entire layout.

You need to use this effect as a layer effect and on a layer on its own!

Without effect:


With effect:


Usage:
1) Create a new layer (named "flipped" in this example)
2) Apply the "Flip Layout"-effect to "flipped"

Everything underneath that layer will then be drawn flipped on the "flipped"-layer (replacing everything that currently is on that layer, so always use a dedicated layer).

The effect has 3 parameters:
flip vertical
flip horizontal
activation

Set any of those to 1.0 to switch them on. Any other value will switch them off.

Note: Activation is there to make it more comfortable to edit your game. The effect will still add to GPU load, it just doesn't show the result. To save GPU load, deactivate the effect using the system actions.

In edit time the effect will look offset, this is not an error. In runtime it will all be ok. Furthermore, the effect only works using a little trick: the colors have to be merged with a very small amount of the layer's color. It's only 0.001% though, so no human being will notice it. And last but not least the usual limitation for pixel shader effects: Windows elements like editboxes or buttons can't be altered, they'll stay at their positions (have a look at the pictures above)

Download: Flip Layout.fx
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Jun 02, 2012 12:07 am

Awesome! I have an effect made just for me! :)

Joking aside, I love it. I have tried it and it happily satisfied my expectation. Now, I need to try to mix it up with some intense stuff going on.

Thank you very much tulamide.

edit:
I did realized that the VRAM shot up quite a lot in comparison (w/ and w/o effect) and I hope it is not relatively proportionate to the original without the effect.

In addition, I believe other might like to know this, but I noticed that movement is also flipped. So, what this effect seems to do is in fact literally mirror the layer(+all layers underneath) and their behaviours as well (NOTE: I have only tried it with horizontal flip and the 8-direction behaviour and pushing the object to go left made it turn around and go right like a drunken friend, and vice-versa). aznmonkeyboy2012-06-02 00:22:12
B
8
S
2
Posts: 40
Reputation: 2,136

Post » Sat Jun 02, 2012 8:15 am

Thanks a bunch Tulamide!

@aznmonkeyboy, I don't think an effect can modify behaviors. You may notice the mirrored movement because the view is flipped. I will give this a try.

Edit: I can confirm this works as expected, the view itself is flipped rather than each object mirrored. Mirroring each individual object would be harder, unless they could all be grouped into families (and then each family is mirrored).Jayjay2012-06-02 08:23:11
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat Jun 02, 2012 2:09 pm

[QUOTE=Jayjay]@aznmonkeyboy, I don't think an effect can modify behaviors. You may notice the mirrored movement because the view is flipped. I will give this a try.[/QUOTE]

I suppose I may have worded it to a point of misunderstanding. I was trying to say that this flip effect is rather akin to looking in a mirror sans text boxes and buttons.
B
8
S
2
Posts: 40
Reputation: 2,136

Post » Sat Jun 02, 2012 6:42 pm

Maybe I misunderstand it, but let me say two things about it:

1) This is a pixel shader. All a pixel shader does is altering pixels when the graphic card is rendering. It does not change behaviors, coordinates and the like.

2) flip horizontal and flip vertical do exactly what the functions in the picture editor do. When you imagine pixels as numbers then the effect (and the picture editor) do the following to the pixels:
before: 01 02 03 04 05 06 07 08 09
after:   09 08 07 06 05 04 03 02 01


If you intended to rather flip all sprite in its local coordinates while keeping the global coordinates on the layout, then you're lost, I'm afraid. This can't be done with only one shader. You'd need to use the "flip horizontal" and "flip vertical" effects (that come with CC) on every object instead. (EDIT: Or flip in code with families, as Jayjay described)

But if I'm wrong, and your intention was something else that this effect does not achieve, could you do a drawing of what you have in mind?tulamide2012-06-02 18:46:22
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Oct 01, 2013 5:04 pm

Hello, I see the file .Fx, but you have the .xml Going with ?

Thank you.
B
4
S
1
Posts: 7
Reputation: 546

Post » Tue Oct 01, 2013 11:43 pm

@absolu Ah this is an effect for Construct Classic, the old open source tool before Construct 2 was made. C2 uses HTML5 and CC only uses DirectX 9, so the effect won't translate over properly as-is either
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Wed Oct 02, 2013 6:33 am

Ok,
Thank you.
B
4
S
1
Posts: 7
Reputation: 546


Return to Completed addons

Who is online

Users browsing this forum: No registered users and 0 guests