Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. ;------------;
  2. ; Spike Hell ;
  3. ;------------;
  4. ; Initial XY positions set by generating sprite.
  5.  
  6. !Speed = $02 ; How many pixels to move per frame.
  7. !YInteractSmOrDu = $20 ; How many pixels to interact with small or ducking Mario, vertically.
  8. !YInteractSmNorDu = $30 ; How many pixels to interact with powerup Mario (not ducking), vertically.
  9.  
  10. SpeedTable:
  11. db $04,$04,$03,$04,$03,$04,$04,$04,$04,$03,$02,$04,$03,$04,$04,$04,$04,$04,$03,$02 ; Speed table, per sprite. Amount of pixels to move down each frame. 00 = still, 80-FF = rise, 01-7F = sink.
  12.  
  13. SpeedTableX:
  14. db $FC,$FD,$FC,$FC,$FC,$FD,$FC,$FC,$FC,$FC,$FD,$FC,$FC,$FC,$FC,$FC,$FC,$FC,$FC,$FC
  15.  
  16.  
  17. OAMStuff:
  18. db $40,$44,$48,$4C,$D0,$D4,$D8,$DC,$80,$84,$88,$8C,$B0,$B4,$B8,$BC,$C0,$C4,$C8,$CC
  19.  
  20.  
  21. IncrementByOne:
  22. LDA $1E02,y ; \ Increment Y position of sprite.
  23. INC A ; |
  24. STA $1E02,y ; |
  25. SEC ; | Check Y position relative to screen border Y position.
  26. SBC $1C ; | If equal to #$F0...
  27. CMP #$F0 ; |
  28. BNE ReturnAndSuch ; |
  29. LDA #$01 ; | Appear.
  30. STA $1E2A,y ; /
  31.  
  32. ReturnAndSuch:
  33. RTS
  34.  
  35. Main:;The code always starts at this label in all sprites.
  36. LDA $1E2A,y ; \ If meant to appear, skip spike hell intro code.
  37. BEQ IncrementByOne ; /
  38.  
  39. SkipIntro:
  40. LDA $9D ; \ Don't move if sprites are supposed to be frozen.
  41. BNE Immobile ; /
  42. LDA $1E02,y ; \
  43. CLC ; |
  44. ADC SpeedTable,y ; | Movement.
  45. STA $1E02,y ; /
  46.  
  47. LDA $1E16,y
  48. CLC ; |
  49. ADC SpeedTableX,y ; | Movement.X
  50. STA $1E16,y ; /
  51.  
  52. LDA $94 ; \ Sprite <-> Mario collision routine starts here.
  53. SEC ; | X collision = #$18 pixels. (#$0C left, #$0C right.)
  54. SBC $1E16,y ; |
  55. CLC ; |
  56. ADC #$0C ; |
  57. CMP #$18 ; |
  58. BCS Immobile ; /
  59. LDA #!YInteractSmOrDu ; Y collision routine starting here.
  60. LDX $73
  61. BNE StoreToNill
  62. LDX $19
  63. BEQ StoreToNill
  64. LDA #!YInteractSmNorDu
  65.  
  66. StoreToNill:
  67. STA $00
  68. LDA $96
  69. SEC
  70. SBC $1E02,y
  71. CLC
  72. ADC #$20
  73. CMP $00
  74. BCS Immobile
  75.  
  76. Immobile: ; OAM routine starts here.
  77. LDX.w OAMStuff,y ; Get OAM index.
  78. LDA $1E02,y ; \ Copy Y position relative to screen Y to OAM Y.
  79. SEC ; |
  80. SBC $1C ; |
  81. STA $0201,x ; /
  82. LDA $1E16,y ; \ Copy X position relative to screen X to OAM X.
  83. SEC ; |
  84. SBC $1A ; |
  85. STA $0200,x ; /
  86. LDA #$E0 ; \ Tile = #$E0.
  87. STA $0202,x ; / (Spike.)
  88. LDA #$35 ; \ Properties per spike, some are rising so this needs a seperate table.
  89. STA $0203,x ; /
  90. PHX
  91. TXA
  92. LSR
  93. LSR
  94. TAX
  95. LDA #$02
  96. STA $0420,x
  97. PLX
  98. LDA $18BF
  99. ORA $1493
  100. BEQ ReturnToTheRTSCommandMyChocolate ; Change BEQ to BRA if you don't want it to disappear at generator 2, sprite D2.
  101. LDA $0201,x
  102. CMP #$F0 ; As soon as the spike is off-screen...
  103. BCC ReturnToTheRTSCommandMyChocolate
  104. LDA #$00 ; Kill sprite.
  105. STA $1892,y ;
  106.  
  107. ReturnToTheRTSCommandMyChocolate:
  108. RTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement