[Plugin] Shake Plugin

  • 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?

  • What kind of shake? X axis, y axis, orbital?

  • What kind of shake? X axis, y axis, orbital?

    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?

  • 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! :)

  • Actually orbital would be a quick circle, or spiral around the camera's origin.

    So, not exactly a shake.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • Derpbox is all 404 on that link.

    shake no https

    I can make an orbital example if you like.

  • 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.

  • Done!

  • Hello firebelly, I would like to know what's original formula of shake.

    I'm trying to use it

    <img src="http://i.imgur.com/qM0ERgy.png" border="0" />

    It worked, but if we change value to Shake_Intense to 500, the object moves to right and bottom than current position.

    Btw, I'm working a framework provides all samples, it will be open source, I will release it soon.

  • Let me check on that!

  • Alternatively, to get working with shaking player while is moving with controls, I use Sine behavior and select movement type is Value.

    Then, create an event:

    -Every Tick

    --Move at Angle, angle is random(0,360) and distance is a value from expression of Sine as "Value" as Return teh current oscillating value, it would work but it doesn't stay the original position, it keeps moving.

  • Link is dead man :(

  • Link is dead man :(

    Woops, should be back now. Got a little excited with the old delete function...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)