Electric cat
Member
please remember that the Ai Action must be 3-4 steps not 2. If it is 2 steps it WILL cause issues
;;;;; THIS MATERIAL ADDED TO SHAKE THE SCREEN ON COMMAND
LDA shakeOn
CMP #$01
BNE shakeskipper
shake:
INC camY ;xScroll
INC XScrollNo ; variable counting the current number of pixels away from the norm
JSR doWaitFrame
LDA #$04 ; this means it will shake four pixels...change the number to what you desire
CMP XScrollNo
BEQ shakeBack
JMP shake
shakeBack:
DEC camY ;xScroll
DEC XScrollNo
JSR doWaitFrame
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:
LDA shakeOn
CMP #$00
BNE shakeskipper
isSolidSoLand:
;; move to position
;;; load the top of the tile that is being run into.
;;check if in a jumping state.
TXA
STA temp
GetActionStep temp
CMP #$02 ;; presums jump is in state 2
BNE +dontChangeToIdle
LDA gamepad
AND #%11110000
BNE +isRunningWhenLanding
;; is idle when landing
LDA #$00
STA temp1
JMP +gotLandingState
+isRunningWhenLanding
LDA #$01
STA temp1
+gotLandingState
LDA ScreenFlags01 ;Uses Screen Flags 2
AND #%01000000 ; Grokk Boss Fight
BEQ +
LDA Object_flags,x
AND #%00001000 ;; is it a monster?
jmp doneWithGravity
+
ChangeActionStep temp, temp1 ;; changes to either idle or running depending on if a direction key is pressed.
+dontChangeToIdle
umaMAZING IDEIA, PanzerBOOM entendi!
Tudo o que eu precisava fazer era editar o doHandlephysics_Platform.asm e adicionar uma verificação para o screenflag e o monstro para desconsiderar a alteração da etapa de ação
Fantastic. Where do I add the shaketrigger.asm triggerThanks 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.
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.
Incredible. I wanted to know more about how to make enemies like this. Do you have any tips about flags, or tutorial?This would be really slick for my boss fight I am working on. Is there anyone that can update this for 4.5.9?
That depends on what you want to do. If you want an enemy to trigger the shake, make the trigger an AI and add it as an Action Step.Fantastic. Where do I add the shaketrigger.asm trigger
Fantastic. Where do I add the shaketrigger.asm trigger
thank you, my friendIsso depende do que você quer fazer. Se você quiser que um inimigo acione o tremor, faça do gatilho uma IA e adicione-o como uma Etapa de Ação.