How do I make an object shake?

0 favourites
  • 9 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hey. Would love to get enemies to shake for a second when hit by the player. I've seen it in a video, but have no idea how to do it. I think guy used the Scroll To behaviour, but when I use it, it just shakes the whole camera! Can anyone help?

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could use the sine behaviour, horizontal or vertical (or both with two sine behaviours) and small values for magnitude and period

    on enemy hit ->stop movement,set sine active, wait 1 second, set sine inactive

  • If you want to do both vertical and horizontal shaking, use different period values for both. Otherwise, it'll just shake diagonally.

    Should be a bit faster than this.

  • Thanks for the replies. I'm a total noob to Construct, so I'm not really sure what I'm at. I've set the values like this, but it kinda just shifts the object a bit. There's no shaking. Sorry to be a pest.

  • set magnitude to the amount of pixels it should shift to the sides and period lower

  • Aw yeah! That's brilliant! Thanks much!

  • I'm doing this for a button and something I ended up doing was make sure that period and duration of the shake worked out so that the object would return to the original location instead of moving around slightly. (using large magnitude helped with testing).

    But as far as I can tell it seems like even if you deactivate the sine in a different location when you reactivate it it'll continue where it left off meaning that it should never move more than the magnitude away from the original location so unless the exact location is important for some reason it should be fine to use any duration for the shake. Not sure if changing layouts or anything would break it.

    Also apparently two 1 second waits and a single 2 second wait wait for different times or something.

  • I'm doing this for a button and something I ended up doing was make sure that period and duration of the shake worked out so that the object would return to the original location instead of moving around slightly. (using large magnitude helped with testing).

    But as far as I can tell it seems like even if you deactivate the sine in a different location when you reactivate it it'll continue where it left off meaning that it should never move more than the magnitude away from the original location so unless the exact location is important for some reason it should be fine to use any duration for the shake. Not sure if changing layouts or anything would break it.

    Also apparently two 1 second waits and a single 2 second wait wait for different times or something.

    You can also use the shake object behaviour

    behavior-shake-not-camera_t166389?&hilit=plugin+shake

    Download: https://rexrainbow.github.io/C2RexDoc/r ... hakeMod.7z

  • hi everyone. is this behavior available for c3?

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