Using sine when mirrored

Get help using Construct 2

Post » Mon Sep 21, 2015 1:20 am

I'm trying to make a simple stretch effect for my character's attack. It's working just like I wanted when the character isn't mirrored, but when they're mirrored they "de-mirror" itself before playing the sine. Changing the sine magnitude from 25 to -25 while the character is mirrored doesn't work either.

What do? I'm out of ideas.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Mon Sep 21, 2015 3:17 am

I do this sort of thing in two sub-events:

Upon pressing F
- Is mirrored
- - equation
- Is not mirrored
- - reverse equation
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Mon Sep 21, 2015 4:23 pm

Tried it already, doesn't work. Even if I change the magnitude to reverse it still swaps the character to non-mirrored state. The sine just moves backwards that way.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Mon Sep 21, 2015 8:42 pm

bump for justice
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Mon Sep 21, 2015 9:14 pm

Just tried to see for myself. It's most definitely a bug, the "mirrored" flag has no effect while a Sine set to "Width" is active. I believe the same would hold true for a Sine set to Height and the "flipped" flag.
Last edited by Magistross on Mon Sep 21, 2015 9:49 pm, edited 2 times in total.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Mon Sep 21, 2015 9:27 pm

Yep. I'm trying to use the "Width" setting. I guess I just gotta make mirrored animations for the attacks until the bug is fixed.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Mon Sep 21, 2015 9:49 pm

After a few more tests, it seems that changing the width of an object glitch its mirrored flag, and changing the height glitch the flipped one. "Is mirrored" and "Is flipped" still register has "true" but they don't appear mirrored/flipped. Definitely not a wanted behavior... In the meantime, here's a capx with a workaround.

https://dl.dropboxusercontent.com/u/700 ... round.capx
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Mon Sep 21, 2015 11:56 pm

Thanks a lot, man! Great job! I'll be posting a bug report soon about this.

EDIT: Could you explain what that "Self.isMirrored ? -1 : 1" part means?

EDIT2: This seems to only work on static objects. My object has an attack animation, so I have to constantly change the "OriginaWidth" and that seems to mess the calculation up pretty badly causing flickering. A static number does work and kinda does what I want and should be good enough for now.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Tue Sep 22, 2015 3:10 am

For your first question, it's an "inline if" or conditional expression, it goes like this "logical expression ? true expression : false expression". In this case, I multiply the width by -1 if mirrored, or by 1 if not.

Yep, indeed, it only works with static object because I used a static number in the formula. Give it another go, I changed the formula a bit so it now uses a percentage of the original animation frame width.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo and 19 guests