Advertisement
NovaYoshi

Enemy.s

Mar 26th, 2011
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.56 KB | None | 0 0
  1. SneakerSprite = $00 | 1
  2. GoombaSprite = $04 | 1
  3. SmushGoombaSprite = $08 | 1
  4. GeorgeSprite = $20 | 1
  5. GeorgeSpurt = $24 | 1
  6. WaterBottleSide = $26 | 1 ; also $28
  7. WaterBottleTall = $2A | 1
  8. ToastBot = $2C | 1 ; also $30
  9. DinnerSprite = $34 | 1
  10.  
  11. .proc EnemyScoreIncrease
  12. .byt 0 ; blank
  13. .byt 25 ; goomba
  14. .byt 100 ; toast bot
  15. .byt 100 ; sneaker
  16. .byt 0 ; George the volcano
  17. .byt 0 ; stomped goomba ( not really used )
  18. .byt 0 ; Poof
  19. .byt 25 ; rotate thing
  20. .byt 0 ; Bill Nye
  21. .byt 75 ; retard goomba
  22. .byt 75 ; cheeseburger
  23. .endproc
  24.  
  25. .proc EnemyHitsToKill
  26. .byt 0<<5 ; blank
  27. .byt 0<<5 ; goomba
  28. .byt 0<<5 ; toast bot
  29. .byt 0<<5 ; sneaker
  30. .byt 0<<5 ; George the volcano
  31. .byt 0<<5 ; stomped goomba ( not really used )
  32. .byt 0<<5 ; Poof
  33. .byt 0<<5 ; rotate thing
  34. .byt 0<<5 ; Bill Nye
  35. .byt 0<<5 ; retard goomba
  36. .byt 0<<5 ; cheeseburger
  37.  
  38. .endproc
  39.  
  40. .proc EnemyGraphic
  41. .byt $00 | 0 ; blank
  42. .byt $04 | 1 ; goomba
  43. .byt $2C | 1 ; toast bot
  44. .byt $00 | 1 ; sneaker
  45. .byt $24 | 1 ; George the volcano
  46. .byt $08 | 1 ; stomped goomba ( not really used )
  47. .byt $00 | 0 ; Poof
  48. .byt $60 | 1 ; rotate thing
  49. .byt $00 | 1 ; Bill Nye (custom routine)
  50. .byt $64 | 1 ; retard goomba
  51. .byt $34 | 1 ; cheeseburger
  52.  
  53. .endproc
  54.  
  55. .proc EnemyWalkSpeed
  56. .byt 0, 0 ; blank
  57. .byt -1, 1 ; goomba
  58. .byt -5, 5 ; toast bot ( FREAKING FAST but takes one hit )
  59. .byt -3, 3 ; sneaker (harder than Goomba)
  60. .byt -10, 10 ; George
  61. .byt 0, 0 ; stomped goomba
  62. .byt 0, 0 ; Poof
  63. .byt -1, 1 ; rotate thing
  64.  
  65. .byt -1, 1 ; Bill Nye
  66. .byt -2, 2 ; retard goomba
  67. .byt -3, 3 ; Cheeseburger
  68.  
  69. .endproc
  70.  
  71. .proc ProcessEnemies
  72. .dj_loop #8, 0
  73. ldx 0
  74. dex
  75. lda EnemyType,x
  76. and #%11110 ; the first bit is the direction bit
  77. jsr Run_Enemy_Routine
  78. .end_djl
  79. rts
  80.  
  81. Run_Enemy_Routine: ; some people get butthurt over JumpEngine
  82. tay
  83. lda Enemy_Routine_Addresses+1,y
  84. pha
  85. lda Enemy_Routine_Addresses+0,y
  86. pha
  87. rts
  88.  
  89. Enemy_Routine_Addresses:
  90. .raddr EnemyNone ;0 - nothing
  91. .raddr EnemySimple ;2 - goomba
  92. .raddr EnemySimple ;4 - toast bot
  93. .raddr EnemySimple ;6 - sneaker
  94. .raddr EnemyNone ;8 - George the volcano
  95. .raddr EnemyStomp ;10 - Stomped Goomba
  96. .raddr EnemyPoof ;12 - EnemyKaboom
  97. .raddr EnemyRotate ;14 - rotate thing
  98. .raddr EnemyNone ;16 - Bill Nye
  99. .raddr EnemySimple ;18 - retard goomba
  100. .raddr EnemyRotate ;20 - Cheeseburger
  101. .raddr EnemyNone ;22 - nothing
  102. .raddr EnemyNone ;24 - nothing
  103. .raddr EnemyNone ;26 - nothing
  104. .raddr EnemyNone ;28 - nothing
  105. .raddr EnemyNone ;30 - nothing
  106.  
  107. EnemyNone: ; Empty enemy slots do nothing
  108. lda #0 ; They die, though
  109. sta EnemyType,x
  110. rts
  111. EnemyStomp: ; I need to code support for stomped goombas.
  112. rts
  113.  
  114. .proc EnemyPoof
  115. ldx 0 ; Get enemy slot number
  116. dex
  117.  
  118. ; was gonna sorta float down but it didn't look very cool
  119. ; lda EnemyStun,x
  120. ; lsr
  121. ; lsr
  122. ; lsr
  123. ; add EnemyPosY,x
  124. ; sta EnemyPosY,x
  125.  
  126. ldy OamPtr
  127. lda EnemyStun,x
  128. pha
  129. add #1
  130. sta EnemyStun,x
  131. cmp #15 ; erase poof after a little bit
  132. bcc ErasePoof
  133. lda #0
  134. sta EnemyType,x
  135.  
  136. inc EnemiesKilled
  137. beq :+
  138. inc EnemiesKilled+1
  139. :
  140.  
  141.  
  142. ; since I can't figure out how to fix this bug I'll make it nicer to experience
  143. ; ( actually fixed, but I'll keep this part in )
  144. cpx #0
  145. bne ErasePoof
  146. : inx
  147. cpx #5 ; no enemy slots to swap?
  148. beq NoSlotsPoof
  149.  
  150. lda EnemyType,x
  151. bne :+
  152. beq :-
  153.  
  154. : sta EnemyType ; copy over to first slot
  155. lda EnemyPosX,x
  156. sta EnemyPosX
  157. lda EnemyPosY,x
  158. sta EnemyPosY
  159. lda EnemyStun,x
  160. sta EnemyStun
  161. lda #0 ; erase old slot
  162. sta EnemyType,x
  163. sta EnemyPosX,x
  164. sta EnemyPosY,x
  165. sta EnemyStun,x
  166. NoSlotsPoof:
  167. ldx #0 ; restore the zero
  168. ErasePoof:
  169.  
  170. pla
  171. lsr
  172. lsr
  173. add #$48
  174. ora #1 ; second page
  175. sta 4
  176.  
  177. ; first half --------------------------------
  178. lda EnemyPosY,x
  179. sta $200,y
  180. iny
  181. lda 4
  182. sta $200,y
  183. iny
  184. lda #0 ; attribute
  185. sta $200,y
  186. iny
  187. lda EnemyPosX,x
  188. sub #8
  189. sta $200,y
  190. iny
  191. ; next half ---------------------------------
  192. lda EnemyPosY,x
  193. sta $200,y
  194. iny
  195. lda 4
  196. sta $200,y
  197. iny
  198. lda #OAM_XFLIP ; attribute
  199. sta $200,y
  200. iny
  201. lda EnemyPosX,x
  202. ; sub #8
  203. sta $200,y
  204. iny
  205. ; done --------------------------------------
  206. sty OamPtr
  207. rts
  208. .endproc
  209.  
  210. .proc EnemyRotate
  211. ldy 0
  212. dey
  213. jsr ChkEnemyTouchBlock
  214. jsr EnemyFlyAcrossScreen
  215. jsr EnemyDisplay2
  216. rts
  217. .endproc
  218.  
  219. .proc EnemySimple
  220. ldy 0
  221. dey
  222. lda EnemyPosY,x ; fall speed
  223. add #4
  224. sta EnemyPosY,x
  225. jsr ChkEnemyTouchBlock
  226. jsr EnemySimpleMove
  227. jsr EnemyDisplay1
  228. rts
  229. .endproc
  230.  
  231.  
  232.  
  233. .proc EnemyFlyAcrossScreen
  234. ldx 0 ; Get enemy slot number
  235. dex
  236. jsr EnemyGetFromTables
  237.  
  238. lda EnemyStun,x ; Stunned? No movement!
  239. beq :+
  240. lda #0
  241. sta 1
  242. sta 2
  243. dec EnemyStun,x
  244. :
  245. lda EnemyType,x ; walk in direction
  246. and #1
  247. tay
  248. lda 1,y ; get walk speed from table based on direction
  249. add EnemyPosX,x
  250. sta EnemyPosX,x
  251.  
  252. .scope check_off_screen ; check if the enemy is off the screen
  253. lda EnemyPosX,x
  254. cmp #256-8 ; need new place?
  255. bcs :+
  256. cmp #8
  257. bcc :+
  258. jmp :++
  259. :
  260. lda #20
  261. sta EnemyPosX,x
  262. stx 10
  263. sty 11
  264. jsr rand_8
  265. ldy 11
  266. ldx 10
  267. sta EnemyPosY,x
  268.  
  269. lda #10
  270. sta EnemyStun,x
  271.  
  272. lda EnemyType,x ; flip horizontally
  273. eor #1
  274. sta EnemyType,x
  275. :
  276. .endscope
  277.  
  278. rts
  279. .endproc
  280.  
  281. .proc EnemyDisplay2 ; two halves are the same
  282. .scope display
  283. ; display
  284. lda retraces
  285. and #%100
  286. bne :+
  287. lda 4
  288. sta 3
  289. :
  290.  
  291. ; cpx #0 ; different color if first one
  292. ; bne :+
  293. ; lda 5
  294. ; ora #1
  295. ; sta 5
  296. ; :
  297.  
  298. ldy OamPtr
  299. lda EnemyPosY,x
  300. sta $200,y
  301. iny
  302. lda 3 ; get graphic
  303. sta $200,y
  304. iny
  305. lda 5 ; get attribute
  306. sta $200,y
  307. iny
  308. lda EnemyPosX,x
  309. sub #8
  310. sta $200,y
  311. iny
  312.  
  313. lda EnemyPosY,x
  314. sta $200,y
  315. iny
  316. lda 3 ; get graphic
  317. sta $200,y
  318. iny
  319. lda 5
  320. ora #OAM_XFLIP ; get attribute
  321. sta $200,y
  322. iny
  323. lda EnemyPosX,x
  324. add #0
  325. sta $200,y
  326. iny
  327. sty OamPtr
  328. .endscope
  329. rts
  330. .endproc
  331.  
  332. .proc EnemyDisplay1 ; flip back and forth between two
  333. .scope display
  334. ; display
  335. ldy OamPtr
  336. lda EnemyPosY,x
  337. sta $200,y
  338. iny
  339. lda 3 ; get graphic
  340. sta $200,y
  341. iny
  342. lda 5 ; get attribute
  343. sta $200,y
  344. iny
  345. lda EnemyPosX,x
  346. sub #8
  347. sta $200,y
  348. iny
  349.  
  350. lda EnemyPosY,x
  351. sta $200,y
  352. iny
  353. lda 4 ; get graphic
  354. sta $200,y
  355. iny
  356. lda 5 ; get attribute
  357. sta $200,y
  358. iny
  359. lda EnemyPosX,x
  360. add #0
  361. sta $200,y
  362. iny
  363. sty OamPtr
  364. .endscope
  365. rts
  366. .endproc
  367.  
  368. .proc EnemyGetFromTables ; read attributes for this enemy
  369. ldx 0 ; Get enemy slot number
  370. dex
  371. lda EnemyType, x ; Get enemy type, for looking up attributes
  372. and #%11110
  373. ; fetch walk speed ( 2 entries )
  374. tay
  375. lda EnemyWalkSpeed,y
  376. sta 1
  377. lda EnemyWalkSpeed+1,y
  378. sta 2
  379.  
  380. lda EnemyStun,x ; stunned enemies can't walk
  381. beq :+
  382. lda #0
  383. sta 1
  384. sta 2
  385. :
  386.  
  387.  
  388. lda #0
  389. ; cpx #0 ; different color if first one
  390. ; bne :+
  391. ; lda #1
  392. ; :
  393. sta 5 ; temp attribute
  394.  
  395. tya
  396. lsr
  397. tay
  398. lda EnemyGraphic,y
  399. sta 3
  400. add #2
  401. sta 4
  402. rts
  403. .endproc
  404.  
  405. .proc EnemySimpleMove
  406. jsr EnemyGetFromTables
  407. ; okay, got everything out of the tables that we need
  408.  
  409. lda #0
  410.  
  411. lda retraces ; simple, crap animation :3
  412. and #%1000
  413. bne :+
  414. lda 3 ; swap left tile and right tile
  415. tay
  416. lda 4
  417. sta 3
  418. tya
  419. sta 4
  420.  
  421. lda 5 ; get attribute
  422. ora #OAM_XFLIP
  423. sta 5 ; poked in
  424. :
  425. lda EnemyStun,x ; flip onto its back if stunned
  426. beq :+
  427. lda 5
  428. ora #OAM_YFLIP
  429. sta 5
  430. dec EnemyStun,x
  431. :
  432.  
  433. ; okay, now we can process this sprite
  434.  
  435. .scope platform_test ; check if the enemy is on a platform
  436. ; see if on a platform
  437. lda EnemyPosY,x
  438. add #16
  439. and #$F0
  440. sta 6
  441. lda EnemyPosX,x
  442. .repeat 4
  443. lsr
  444. .endrep
  445. ora 6
  446. tay
  447. lda LevelBuf,y
  448. cmp #1
  449. beq IsOnPlatform ; IS on platform!
  450. stx 8
  451. jsr rand_8
  452. ldx 8
  453. and #8
  454. lsr
  455. lsr
  456. lsr
  457. eor EnemyType,x
  458. sta EnemyType,x
  459. jmp IsNotOnPlatform
  460. IsOnPlatform:
  461. lda EnemyPosY,x ; round to nearest metatile
  462. and #%11110000
  463. sta EnemyPosY,x
  464.  
  465. lda EnemyType,x ; check sideways for wall collision
  466. and #1
  467. tay
  468. lda 1,y ; get walk speed from table based on direction
  469. add EnemyPosX,x
  470. .repeat 4
  471. lsr
  472. .endrep
  473. sta 6
  474. lda EnemyPosY,x
  475. ;sub #8
  476. and #$F0
  477. ora 6
  478. tay
  479. lda LevelBuf,y
  480. cmp #1
  481. bne :+
  482. lda EnemyType,x
  483. eor #1
  484. sta EnemyType,x
  485. :
  486.  
  487. lda EnemyType,x ; walk in direction
  488. and #1
  489. tay
  490. lda 1,y ; get walk speed from table based on direction
  491. add EnemyPosX,x
  492. sta EnemyPosX,x
  493. jmp WasOnPlatform
  494.  
  495. IsNotOnPlatform:
  496. lda EnemyType,x
  497. and #%111110
  498. cmp #9*2 ; Sneaker?
  499. bne Land_NotRetardGoomba
  500. lda EnemyType,x
  501. and #%11111110
  502. ora #1
  503. sta EnemyType,x
  504. tay
  505.  
  506. lda EnemyPosX,x
  507. cmp UserPosX
  508. bcc RetardGoomba_NotLeft
  509. dey
  510. tya
  511. sta EnemyType,x
  512. RetardGoomba_NotLeft:
  513. Land_NotRetardGoomba:
  514. WasOnPlatform:
  515.  
  516. .endscope
  517. .scope check_off_screen ; check if the enemy is off the screen
  518. lda EnemyPosX,x
  519. cmp #256-8 ; need new place?
  520. bcs :+
  521. cmp #8
  522. bcc :+
  523. jmp :++
  524. :
  525. lda #128
  526. sta EnemyPosX,x
  527. lda #10
  528. sta EnemyPosY,x
  529.  
  530. lda EnemyType,x ; flip horizontally
  531. eor #1
  532. sta EnemyType,x
  533. :
  534. .endscope
  535. rts
  536. .endproc
  537.  
  538.  
  539. .endproc
  540.  
  541.  
  542. ; goomba
  543. ; s-kill flings-1
  544. ; t.bot
  545. ; s-none flings-2
  546. ; sneaker
  547. ; s-hurt flings-3
  548. ; george
  549. ; s-hurt flings-3
  550.  
  551. ; HHHTTTTD
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568. .proc ChkEnemyTouchBlock ; don't care which block, just that a block touched
  569. EnemyIndex = 14
  570. BlockCounter = 6
  571. TempX1 = 2
  572. TempY1 = 3
  573. TempX2 = 4
  574. TempY2 = 5
  575.  
  576. lda EnemyStun,y
  577. sty EnemyIndex ; enemy index backup
  578.  
  579. .dj_loop #BlockNumber, BlockCounter
  580. ldx BlockCounter
  581. dex
  582.  
  583. lda BlocksEnabled
  584. and Bitfield,x
  585. beq NextIndex
  586.  
  587. ldy EnemyIndex
  588. jsr runtest1
  589. .end_djl
  590.  
  591. ldy EnemyIndex
  592. jsr runtest2
  593. rts
  594.  
  595. runtest1: ; enemy to block
  596. ldy EnemyIndex
  597. lda BlockX,x
  598. sub #8
  599. sta TempX1
  600.  
  601. lda BlockY,x
  602. sta TempY1
  603.  
  604. lda EnemyPosX,y ; 8x16 so offset left by 8 to make it into a 16x16 area
  605. sub #8
  606. sta TempX2 ; D
  607.  
  608. lda EnemyPosY,y
  609. sta TempY2 ; E
  610.  
  611. jsr CheckBlk
  612.  
  613. lda TempX1
  614. sta TempX2
  615. lda TempY1
  616. sta TempY2
  617.  
  618. lda EnemyPosX,y ; 8x16 so offset left by 8 to make it into a 16x16 area
  619. sub #8
  620. sta TempX1
  621. lda EnemyPosY,y
  622. sta TempY1
  623. jsr CheckBlk
  624. rts
  625.  
  626. runtest2: ; enemy to user
  627. ldy EnemyIndex
  628. lda UserPosX,x
  629. sub #8
  630. sta TempX1
  631.  
  632. lda UserPosY,x
  633. sub #8
  634. sta TempY1
  635.  
  636. lda EnemyPosX,y ; 8x16 so offset left by 8 to make it into a 16x16 area
  637. sub #8
  638. sta TempX2 ; D
  639.  
  640. lda EnemyPosY,y
  641. sta TempY2 ; E
  642.  
  643. jsr CheckUsr
  644.  
  645. lda TempX1
  646. sta TempX2
  647. lda TempY1
  648. sta TempY2
  649.  
  650. ldy EnemyIndex
  651. lda EnemyPosX,y ; 8x16 so offset left by 8 to make it into a 16x16 area
  652. sub #8
  653. sta TempX1
  654. lda EnemyPosY,y
  655. sta TempY1
  656. jsr CheckUsr
  657. NoCol2:
  658. clc
  659. rts
  660.  
  661.  
  662.  
  663. CheckUsr:
  664. lda TempX1
  665. cmp TempX2
  666. bcc NoCol2
  667.  
  668. lda TempX2
  669. add #16
  670. cmp TempX1
  671. bcc NoCol2
  672.  
  673. lda TempY1
  674. cmp TempY2
  675. bcc NoCol2
  676.  
  677. lda TempY2
  678. add #16
  679. cmp TempY1
  680. bcc NoCol2
  681.  
  682. pla ; pop "Check"'s return address off stack
  683. pla
  684.  
  685. ; apply damage to the enemy
  686. ldy EnemyIndex
  687. lda EnemyStun,y
  688. beq NotStunned
  689. lda #20
  690. sta UserBounceEnemy
  691.  
  692. lda #0 ; put it back on its feet
  693. sta EnemyStun,y
  694.  
  695. lda #-4
  696. sta UserVelY
  697.  
  698. lda EnemyType,y ; HP is stored alongside enemy type and direction
  699. lsr ; Divide by 2 to get enemy type
  700. pha
  701. and #%1111 ; Mask off everything that isn't the enemy type
  702. tax ; We're going to use it as an index later
  703. pla
  704. and #%01110000 ; Take JUST the hit counter
  705. add #%00010000 ; Add one to the hit counter
  706. sta 6 ; Save it for a bit
  707. cmp EnemyHitsToKill,x
  708. bcc NotKilled
  709.  
  710. lda Score
  711. add EnemyScoreIncrease,x
  712. sta Score
  713. bcc :+
  714. inc Score+1
  715. :
  716.  
  717.  
  718. ldy EnemyIndex
  719. lda #12 ; poof
  720. sta EnemyType,y
  721.  
  722. lda #CH_ALL ; make a nice explosion sound
  723. sta SND_CHN
  724. lda #10 | SQ_1_2
  725. sta NOISE_VOL
  726. lda #255
  727. sta NOISE_LO
  728. lda #%00001000
  729. sta NOISE_HI
  730. jmp NotStunned ; don't rewrite EnemyType
  731. ; or play the other sound
  732. NotKilled:
  733. lda #CH_ALL
  734. sta SND_CHN
  735. lda #4 | SQ_1_4
  736. sta SQ1_VOL ; for pulse 1
  737. lda #15 ;SWEEP_OFF
  738. sta SQ1_SWEEP ; for pulse 1
  739. lda #255
  740. sta SQ1_LO
  741. lda #%00001010
  742. sta SQ1_HI
  743.  
  744. ldy EnemyIndex
  745. lda EnemyType,y
  746. and #%00011111 ; Kill health bits
  747. .ifdef REAL_CONSOLE
  748. slo 6 ; OR in new value
  749. .else
  750. asl 6
  751. ora 6
  752. .endif
  753. sta EnemyType,y ; Updated health
  754. rts
  755. NotStunned: ; this means player killed
  756. lda UserBounceEnemy
  757. bne NotHurtByEnemy
  758.  
  759. lda #12 ; So an enemy can't kill you over and over and over
  760. sta EnemyType,y
  761. lda #0
  762. sta EnemyStun,y
  763. jsr PlayerHurt
  764.  
  765. NotHurtByEnemy:
  766. rts
  767.  
  768. NoCol1:
  769. clc
  770. rts
  771.  
  772. CheckBlk:
  773. lda TempX1
  774. cmp TempX2
  775. bcc NoCol1
  776.  
  777. lda TempX2
  778. add #16
  779. cmp TempX1
  780. bcc NoCol1
  781.  
  782. lda TempY1
  783. cmp TempY2
  784. bcc NoCol1
  785.  
  786. lda TempY2
  787. add #16
  788. cmp TempY1
  789. bcc NoCol1
  790.  
  791. pla ; pop "Check"'s return address off stack
  792. pla
  793. ldy EnemyIndex
  794.  
  795. lda #200 ; increased a little
  796. sta EnemyStun,y
  797.  
  798. lda #CH_ALL ; make a nice explosion sound
  799. sta SND_CHN
  800. lda #5 | SQ_1_2
  801. sta NOISE_VOL
  802. lda #32
  803. sta NOISE_LO
  804. lda #%00001000
  805. sta NOISE_HI
  806.  
  807. rts
  808. .endproc
  809. .proc PlayerHurt ; stupid fly-into-sky animation
  810. dec UserLives
  811.  
  812. lda #180 ; invincible for a bit after dying
  813. sta UserBounceEnemy
  814.  
  815. lda #CH_ALL ; make a nice explosion sound
  816. sta SND_CHN
  817. lda #10 | SQ_1_2
  818. sta NOISE_VOL
  819. lda #50
  820. sta NOISE_LO
  821. lda #%00001000
  822. sta NOISE_HI
  823.  
  824. rts
  825.  
  826.  
  827.  
  828.  
  829. ; clear sprites
  830. ldx #0
  831. txa
  832. : sta $200,x
  833. inx
  834. bne :-
  835.  
  836. ; float up into the sky
  837. lda #0
  838. sta 5 ; y velocity
  839. : lda UserPosY
  840. sub 5
  841. bcc EndAwesome ; comment this line out for longer animation
  842. sta UserPosY
  843. inc 5
  844. jsr DrawPlayer
  845. jsr wait_vblank
  846. lda #CH_ALL
  847. sta SND_CHN
  848. lda #4 | SQ_1_4
  849. sta SQ1_VOL ; for pulse 1
  850. lda #15 ;SWEEP_OFF
  851. sta SQ1_SWEEP ; for pulse 1
  852. jsr rand_8
  853. sta SQ1_LO
  854. lda #%00001000
  855. sta SQ1_HI
  856. lda UserPosY
  857. bne :-
  858. EndAwesome:
  859.  
  860. ; make sure the player isn't caught in the ceiling
  861. lda #32
  862. sta UserPosY
  863. add #AdjustPlayerYForChecking
  864. and #%11110000
  865. sta 5
  866. lda UserPosX
  867. .repeat 4 ; divide by 16
  868. lsr
  869. .endrep
  870. add 5
  871. tax
  872. TestIndex:
  873. lda LevelBuf,x
  874. bne OkayIndex
  875.  
  876. lda UserPosY
  877. add #16
  878. sta UserPosY
  879. txa
  880. add #16
  881. tax
  882. jmp TestIndex
  883. OkayIndex:
  884.  
  885. rts
  886. .endproc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement