[Plugin] Shake Plugin

Post your completed addons to share with the community

Post » Tue Jun 25, 2013 12:58 am

I don't know if anyone else needs it, but I'm working on a hack of the scrollto plugin. It basically gives you the shake function, but doesn't do the scrollto part. So you can do a shake, but also use custom scrollto/lerp functions at the same time. I added an offset to the shake too because it is based on a center of the screen starting point.

So if your character is always 200 pixels below center or something, you set the yOffset to -200 and it will adjust the shake accordingly.

If anyone is interested I'll post it, but I'd like to take suggestions too.

Description: Shakes screen for a set number of seconds and magnitude. Also has settings for an offset since the shake assumes screen center. You can pick where it shakes. Best case use, attach to your main character who is in the middle of the screen.
Version 0.1: [http://dl.dropboxusercontent.com/u/122492/shake.zip]


Future updates: Option to attach to a sprite location instead of center, so you can pick between offset/stick to sprite. Possibly add orbital shake? firebelly2013-07-02 00:26:20
B
30
S
10
G
7
Posts: 416
Reputation: 7,239

Post » Tue Jun 25, 2013 1:21 am

What kind of shake? X axis, y axis, orbital?
Image ImageImage
B
164
S
49
G
139
Posts: 7,966
Reputation: 92,398

Post » Tue Jun 25, 2013 1:26 am

[QUOTE=newt] What kind of shake? X axis, y axis, orbital?[/QUOTE]

Right now it's an ordinary x/y shake which comes with scrollto.

                    var a = Math.random() * Math.PI * 2;
                    var d = Math.random() * mag;
                    offx = Math.cos(a) * d;
                    offy = Math.sin(a) * d;

What would an orbital shake look like?
B
30
S
10
G
7
Posts: 416
Reputation: 7,239

Post » Tue Jun 25, 2013 4:23 am

@firebelly

I was looking to do exactly this in my project, just haven't gotten to it yet. I would totally use this plugin!

Please share! :)
B
8
S
2
G
4
Posts: 64
Reputation: 3,199

Post » Tue Jun 25, 2013 4:27 am

Actually orbital would be a quick circle, or spiral around the camera's origin.
So, not exactly a shake.
Image ImageImage
B
164
S
49
G
139
Posts: 7,966
Reputation: 92,398

Post » Tue Jun 25, 2013 1:37 pm

I requested this update to the shake action http://www.scirra.com/forum/suggestion-shake-action-update_topic69324.html but haven't heard any response. I'd be interested in using it if it had that functionality.
B
77
S
49
G
35
Posts: 358
Reputation: 22,433

Post » Tue Jun 25, 2013 5:10 pm

Here is the behavior.
Let's call this v0.1
https://dl.dropboxusercontent.com/u/122492/shake.zip

Remember, shake sets the viewpoint to the middle unless you specify offsets.

So if you have very custom scrolling, it may get "weird".

One example is: The game starts with scrolling off. When the player hits the middle of the screen, scrolling is enabled and center is set to the middle of the middle of the screen. If the player shakes before he hits this line, the shake function will make the screen jump to the middle.

I think the next version, I'll tweak it to make it really just lock on to the sprite itself and not the middle of the screen.
B
30
S
10
G
7
Posts: 416
Reputation: 7,239

Post » Tue Jun 25, 2013 6:42 pm

Derpbox is all 404 on that link.

shake no https

I can make an orbital example if you like.newt2013-06-25 18:43:38
Image ImageImage
B
164
S
49
G
139
Posts: 7,966
Reputation: 92,398

Post » Mon Jul 01, 2013 7:26 am

@firebelly: It would be nice if you could edit and maintain a correct link and explanation/documentation of the plugin in the first post of the topic, as well as edit the title to add the "[Plugin]" prefix.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
268
S
96
G
67
Posts: 7,219
Reputation: 73,739

Post » Tue Jul 02, 2013 12:21 am

Done!
B
30
S
10
G
7
Posts: 416
Reputation: 7,239

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest