Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SpikyInteraction:
- LDA $1490|!addr ;if player is using the star
- BEQ + ;kill the sprite
- %Star()
- RTS
- +
- LDA $187A|!addr ;If player is riding yoshi then skip spinjump check
- BNE +
- LDA $140D|!addr ;if player is doing spin jump then check if can do spin jump over the sprite; otherwise damage the player
- BEQ +++
- +
- LDA !PlayerYSpeed ;\
- SEC ;|Get relative speed between player and the sprite, if it is negative then damage the player
- SBC !SpriteYSpeed,x ;/
- BMI +++ ;other wise check the position of the player
- STZ !ScratchD
- LDA !Scratch3
- STA !ScratchC ;Loads height of the player hitbox on Scratch C
- LDA !Scratch9
- XBA
- LDA !Scratch1 ;Loads player hitbox Y position
- REP #$20
- CLC
- ADC !ScratchC ;A =Player hitbox Y position + hitbox height = Bottom of the hitbox
- SEC
- SBC #$0008
- STA !ScratchC ;!Scratch C = Bottom of player hitbox - 8 (to detects a range)
- SEP #$20
- LDA !ScratchB ;A = top of Sprite hitbox
- XBA
- LDA !Scratch5
- REP #$20
- CMP !ScratchC ;compare Top of the sprite hitbox with the Bottom of player hitbox - 8 (to detects a range)
- BCC +++ ;If the top of the sprite hitbox is on a position Higher than bottom of player hitbox then do spin jump
- PHA ;\
- LDA !ScratchC ;|
- SEC ;|
- SBC $01,s ;|
- ADC #$0008 ;|Moves the player to the top of the sprite hitbox
- STA !ScratchC ;|
- PLA ;|
- ;|
- LDA !PlayerY ;|
- SEC ;|
- SBC !ScratchC ;|
- STA !PlayerY ;|
- ;|
- SEP #$20 ;/
- JSL $01AB99|!rom ;Display White Star
- JSL $01AA33|!rom ;Do the player boost its Y Speed
- LDA #$02
- STA $1DF9|!addr ;Play Spin Jump Sound
- ;#######################################################################
- ;Here you can add code that happend when the player spin jump the sprite
- ;#######################################################################
- RTS ;Return
- +++
- SEP #$20
- ;###########################################################################
- ;Here you can add code that happend when the player is damaged by the sprite
- ;##########################################################################
- PHX
- LDA $187A|!addr ;if the player is not riding yoshi then damage the player
- BEQ + ;otherwise dismount yoshi
- JSR FindYoshi
- BCC +
- JSR DismountYoshi
- PLX
- RTS
- +
- JSL $00F5B7|!rom
- PLX
- RTS
- FindYoshi:
- LDX $18DF|!addr
- BEQ .crawlForYoshi
- DEX
- BRA .found
- .crawlForYoshi:
- LDX.w $1692|!addr
- ; Start Slot according to sprite data
- LDA.l $02A773|!rom,x
- SEC
- SBC #$FE ; spaces 2 reserved slots, have to interact with them too
- TAX
- .loop:
- LDA !SpriteNumber,x
- CMP #$35
- BNE .continueLoop
- LDA !SpriteStatus,x
- BNE .found
- .continueLoop
- DEX
- BPL .loop
- .returnClear:
- CLC
- RTS
- .found
- SEC
- RTS
- DismountYoshi:
- LDA #$10
- STA !SpriteDecTimer6,x
- LDA #$03 ; \ Play sound effect
- STA $1DFA|!addr ; /
- LDA #$13 ; \ Play sound effect
- STA $1DFC|!addr ; /
- LDA #$02
- STA !SpriteMiscTable3,x
- STZ $187A|!addr
- LDA #$C0
- STA !PlayerYSpeed
- STZ !PlayerXSpeed
- %SubHorzPos()
- LDA XSpeedDismountTable,y
- STA !SpriteXSpeed,X
- STZ !SpriteMiscTable10,x
- STZ !SpriteMiscTable6,X
- STZ $18AE|!addr
- STZ $0DC1|!addr
- LDA #$30 ; \ Mario invincible timer = #$30
- STA $1497|!addr ; /
- JSR CODE_01EDCC
- RTS ; Return
- XSpeedDismountTable:
- db $E8,$18
- CODE_01EDCC:
- LDY.B #$00
- LDA !SpriteYLow,X
- SEC
- SBC YoshiOffset,Y
- STA !PlayerY
- STA $D3
- LDA !SpriteYHigh,X
- SBC #$00
- STA !PlayerY+$01
- STA $D4
- RTS ; Return
- YoshiOffset:
- db $04,$10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement