Custom Sceen Shake

Mee123

  • Posts: 21
I like to make "almost 16-bit" games. And on SNES games, the screen shake is only shaking in one direction, unlike stencyl's "shake screen" block, which shakes in all directions. For future reference, I'd like to know how to make the screen shake in one direction using custom blocks. And I have some specifications:
          - Custom block like: [Shake screen with %0px intensity with %1 seconds interval]
                    - "%0" is how many pixels from the original screen position to shake to/from
                    - "%1" is the time between the repositions of the screen.
          - Shaking diagonally (From Lower Left to Upper Right)
If you have any questions about these, let me know....

rob1221

  • *
  • Posts: 9471
The screen shake is a random adjustment of engine.master.x and engine.master.y, which you can adjust with some code.

Mee123

  • Posts: 21
Wow! That helps me a lot! Cool! Thank you so much!
I'm gonna try it out!


Mee123

  • Posts: 21
Um.... Could you specify on how to adjust the values?

rob1221

  • *
  • Posts: 9471
The easiest way to do this is to create attributes, modify those attributes with blocks, and then add a couple code blocks to set the master values.  For example, if you set an attribute called "X" and an attribute called "Y", you can use this code:

engine.master.x = _X;
engine.master.y = _Y;

Mee123

  • Posts: 21
THANK YOU SO MUCH!!!
...Another thing... what are the default values of the "master"s?


Mee123

  • Posts: 21
Thank you for all your help. I'm glad there are people in the world who are willing to help people. Thank you.