Geekboy

Untitled

Mar 19th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. SmallBulletCollision: ;E=Y D=X (bullet)
  3.  ld hl,$8E01 ;starting off with byte needed to see if anything is there
  4.  ld bc,$0A08 ;ten enemies, using C as a constant for adjustments
  5. SmallBulletCollisionLoop:
  6.  xor a
  7.  cp (hl)
  8.  jr z,SmallBulletCollisionSkip
  9.  inc L
  10.  inc L
  11.  inc L  ;position Y
  12.  ld a,(hl)
  13.  sub e   ;bY-eY. 10-12. Carry means no collide
  14.  jr nc,SmallBulletCollisionSkipY
  15.  add a,c
  16.  jr nc,SmallBulletCollisionSkipY
  17.  inc L
  18.  ld a,(hl) ;position X
  19.  sub d   ;same deal as above. Skipping comments.
  20.  jr nc,SmallBulletCollisionSkipX
  21.  add a,c    ;
  22.  jr nc,SmallBulletCollisionSkipX
  23. ;Collision happened. We may trash this bullet entry now via calling.
  24.  ld c,1  ;BASE WEAPON POWER
  25.  call DamageEnemy
  26.  jp PBTDestroy
  27. SmallBulletCollisionSkip:
  28.  ld a,20
  29.  jp _
  30. SmallBulletCollisionSkipY:
  31.  ld a,17
  32.  jp _
  33. SmallBulletCollisionSkipX:
  34.  ld a,16
  35. _:
  36.  add a,L
  37.  ld L,a
  38.  djnz SmallBulletCollisionLoop
  39. SmallBulletCollisionBossCheck:
  40.  
  41.  xor a
  42.  cp (hl)
  43.  jp z,SmallBulletCollideReturn
  44.  inc L
  45.  inc L
  46.  inc L  ;position Y
  47.  ld a,(hl)
  48.  sub e   ;bY-eY. 10-12. Carry means no collide
  49.  jp nc,SmallBulletCollideReturn
  50.  add a,c    ;(bY-eY)-8. (22-20)-8. Carry means CAN collide, else no collide
  51.  jp nc,SmallBulletCollideReturn
  52.  inc L
  53.  ld a,(hl) ;position X
  54.  sub d   ;same deal as above. Skipping comments.
  55.  jp nc,SmallBulletCollideReturn
  56.  add a,c    ;
  57.  jp nc,SmallBulletCollideReturn
  58.  ld c,1 ;BASE POWER
  59.  call DamageBoss
  60.  jp PBTDestroy
  61. SmallBulletCollideReturn;
  62.  jp (ix)
  63. ;2
Advertisement
Add Comment
Please, Sign In to add comment