[Behavior] flip Sprite

Post your completed addons to share with the community

Post » Sat Dec 21, 2013 3:45 pm

Pode i try your behavior Sprite turns only on center its possible to flip on origin point? or on left/right side?
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Sat Mar 01, 2014 5:19 am

@pode, great behavior!

By chance do you have an updated version kicking around? :)

I've noticed that I can't seem to apply the behavior to an object and then set a "on touch" event to trigger the flipping, I need to bind the flip action to a button (or other UI element) that will THEN flip the respective sprite.

Fingers crossed :D

-Remy
B
56
S
13
G
1
Posts: 151
Reputation: 4,499

Post » Mon Mar 31, 2014 1:50 am

Sooo, since it seems this plugin wasn't supported anymore (and I really wanted to use it) I tried to cobble together something myself....

The GOOD: I WAS able to reproduce a similar effect using the Tweenlite Plugin without any of the quirky errors discussed in this thread also with much more customization
The BAD: It's not as smooth, but it will definitely serve as a poor man's version of the flip Sprite plugin :)

In short:

-Still have a sprite with two frames (could easily add more too, I think someone asked about that earlier in this thread?)
-On click, start a tween of the sprite's width down to 0 'absolutely' (give the tween a duration of about 0.5 seconds with an easing of your choice -- "EaseInBack" gives you a nice little pulsation at the beginning and end)
-This is now considered the halfway point of the flip so now with the width set to 0, set the animation frame to the second image in your sprite
-Call the "reverse" tween function

Voila! Again, it's not as smooth as the Flip sprite plugin and there is a bit of perspective lost as it's not an actual 3D transform but it will do. Perhaps the smoothness is because it's not hardware accelerated? (SOURCE?)

Enjoy all, and cheers to Pode for exposing me to this behavior and inspiring me to work around the issues I was having.

-Remy
B
56
S
13
G
1
Posts: 151
Reputation: 4,499

Post » Wed Aug 12, 2015 11:18 am

Nice behavior, it worked well on your demo, but I can see many are complaining about bugs.
I downloaded it, tried it, and it does not work well. I am using Construct version 206.
When you click to flip, the back frame is shown very quickly, and then it comes back to front frame. Then you click again, and it comes back to back frame, but suddenly it comes back to front frame. So for me it's useless, unfortunately.
Looking forward to a new version update...
B
4
Posts: 4
Reputation: 214

Post » Wed Aug 12, 2015 11:24 am

@klebson

Considering the plugin hasn't been updated for years and Pode himself hasn't posted for over 9 months, it's looks unlikely an update will appear anytime soon.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,841
Reputation: 48,283

Post » Sat Aug 15, 2015 7:20 pm

@remy-jay you don't actually need any plugins.. here's a small prototype I did a while ago that does something similar:

It's only 8 events but I think it could still be improved (maybe lerping the scale instead of height/width?)

https://dl.dropboxusercontent.com/u/238 ... proto.capx
B
106
S
35
G
36
Posts: 793
Reputation: 24,705

Post » Sun Aug 16, 2015 5:24 am

@andreyin Well done and thanks for sharing. That's really cool.
B
38
S
10
Posts: 106
Reputation: 3,265

Post » Sat Feb 13, 2016 11:51 pm

Hi .. I am on 221r

and seams that it fails

Javascript error!
TypeError: this.inst.type.animations[0].frames[1] is undefined
http://localhost:50000/Flip_behavior.js, line 59 (col 3)

Cheers
B
22
S
12
G
10
Posts: 322
Reputation: 7,353

Previous

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 6 guests