Bucket Mouse
Active member
Thanks to Mr. Granato for pointing me in the right direction to find the solution to this....
UPDATED 5-24-2020 to fix a bug that prevented the sprites from showing during the shaking process
Make three variables, shakeOn, XScrollNo and shakeCycle, before using.
Then open HandleScreenLoads.asm and add this right below the opening line. The notes in the code describe how it works.
Now you'll need a trigger to make the screen shake when you want it to. So create a file called shaketrigger.asm that contains just these two lines:
This code shakes the screen horizontally. To shake it vertically, change "xScroll" to "yScroll"
You cannot move your character while the screen shakes. Any sprites on screen will also be stationary. This is just how screen shake works on 8-bit (I distinctly remember Link's Awakening screen shakes working like this).
Au naturel, it works as a button press and as a monster AI option (which makes it perfect for cutscenes). But if you want to add the effect to a tile, the screen will shake endlessly because your sprite is perpetually on it. You will have to add a fourth variable, shakeOff. You would put this before everything else in the script:
Then add
shakeReallyOver:
at the end.
This will prevent the screen shake from looping again. Though you will have to reset shakeOff back to zero if you want to use the same tile somewhere else.
UPDATED 5-24-2020 to fix a bug that prevented the sprites from showing during the shaking process
Make three variables, shakeOn, XScrollNo and shakeCycle, before using.
Then open HandleScreenLoads.asm and add this right below the opening line. The notes in the code describe how it works.
Code:
;;;;; THIS MATERIAL ADDED TO SHAKE THE SCREEN ON COMMAND
LDA shakeOn
CMP #$01
BNE shakeskipper
shake:
INC xScroll
INC XScrollNo ; variable counting the current number of pixels away from the norm
JSR WaitFrame
LDA #$04 ; this means it will shake four pixels...change the number to what you desire
CMP XScrollNo
BEQ shakeBack
JMP shake
shakeBack:
DEC xScroll
DEC XScrollNo
JSR WaitFrame
LDA #$00
CMP XScrollNo
BEQ shakeOver
JMP shakeBack
shakeOver:
INC shakeCycle ; variable for number of vibrations in sequence
LDA shakeCycle
CMP #$04 ; stops shaking after four vibrations...change the number to what you desire
BNE shake
LDA #$00
STA shakeCycle ; resets the shake cycle so you can use it again elsewhere
STA shakeOn
shakeskipper:
;;; END OF ADDED MATERIAL
Now you'll need a trigger to make the screen shake when you want it to. So create a file called shaketrigger.asm that contains just these two lines:
Code:
LDA #$01
STA shakeOn
This code shakes the screen horizontally. To shake it vertically, change "xScroll" to "yScroll"
You cannot move your character while the screen shakes. Any sprites on screen will also be stationary. This is just how screen shake works on 8-bit (I distinctly remember Link's Awakening screen shakes working like this).
Au naturel, it works as a button press and as a monster AI option (which makes it perfect for cutscenes). But if you want to add the effect to a tile, the screen will shake endlessly because your sprite is perpetually on it. You will have to add a fourth variable, shakeOff. You would put this before everything else in the script:
Code:
LDA shakeOff
CMP #$01
BEQ shakeReallyOver
INC shakeOff
Then add
shakeReallyOver:
at the end.
This will prevent the screen shake from looping again. Though you will have to reset shakeOff back to zero if you want to use the same tile somewhere else.