Advertisement
TheBlad768

Orbinaut enemy

Oct 4th, 2023 (edited)
1,308
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ---------------------------------------------------------------------------
  2. ; Object 60 - Orbinaut enemy (LZ, SLZ, SBZ)
  3. ; ---------------------------------------------------------------------------
  4.  
  5. ; Dynamic object variables
  6. orb_count            = objoff_39
  7. orb_rotation             = objoff_40
  8.  
  9. ; =============== S U B R O U T I N E =======================================
  10.  
  11. Obj_Orbinaut:
  12.         move.w  #-$40,x_vel(a0)                 ; move orbinaut to the left
  13.         btst    #0,status(a0)                           ; is orbinaut facing left??
  14.         beq.s   .rot                                ; if not, branch
  15.         neg.w   x_vel(a0)                       ; move orbinaut to the right
  16.  
  17. .rot
  18.         moveq   #1,d0
  19.         btst    #0,status(a0)                           ; is orbinaut facing left?
  20.         beq.s   .noflip                         ; if not, branch
  21.         neg.w   d0
  22.  
  23. .noflip:
  24.         move.b  d0,orb_rotation(a0)
  25.  
  26.         ; mapping
  27.         lea ObjDat_Orbinaut(pc),a1              ; LZ specific code
  28.         jsr (SetUp_ObjAttributes).w
  29.         clr.b   routine(a0)
  30.  
  31.         ; check level
  32.         cmpi.b  #id_SBZ,(Current_zone).w            ; check if level is SBZ
  33.         bne.s   .notscrap
  34.         move.w  #$429,art_tile(a0)              ; SBZ specific code
  35.  
  36. .notscrap
  37.         cmpi.b  #id_SLZ,(Current_zone).w            ; check if level is SLZ
  38.         bne.s   .notslz
  39.         move.w  #$255B,art_tile(a0)             ; SLZ specific code
  40.  
  41. .notslz
  42.  
  43.         ; set
  44.         move.l  #.chksonic,address(a0)
  45.         tst.b   subtype(a0)
  46.         beq.s   .load
  47.         move.l  #.move,address(a0)
  48.  
  49. .load
  50.         lea ChildObjDat6_Orbinaut_Orb(pc),a2
  51.         move.b  1(a2),orb_count(a0)             ; set number of orbs
  52.         jmp (CreateChild6_Simple).w
  53. ; ---------------------------------------------------------------------------
  54.  
  55. .chksonic
  56.         jsr (Find_SonicTails).w
  57.         cmpi.w  #160,d2                         ; is Sonic within $A0 pixels of orbinaut?
  58.         bhs.s   .draw                           ; if not, branch
  59.         cmpi.w  #80,d3                          ; is Sonic within $50 pixels of orbinaut?
  60.         bhs.s   .draw                           ; if not, branch
  61.         tst.w   (Debug_placement_mode).w        ; is debug mode on?
  62.         bne.s   .draw                           ; if yes, branch
  63.         addq.b  #1,anim(a0)                     ; use "angry" animation
  64.         move.l  #.draw,address(a0)
  65.         bra.s   .draw
  66. ; ---------------------------------------------------------------------------
  67.  
  68. .move
  69.         jsr (MoveSprite2).w
  70.  
  71. .draw
  72.         lea Ani_Orb(pc),a1
  73.         jsr (AnimateSprite_Reverse).w
  74.         jmp (Sprite_CheckDeleteTouch).w
  75.  
  76. ; ---------------------------------------------------------------------------
  77. ; Orbinaut enemy (Orb)
  78. ; ---------------------------------------------------------------------------
  79.  
  80. ; Dynamic object variables
  81. orbo_radius          = objoff_3A
  82. orbo_angle           = objoff_3C
  83.  
  84. ; =============== S U B R O U T I N E =======================================
  85.  
  86. Obj_Orbinaut_Orb:
  87.  
  88.         ; set pos
  89.         moveq   #0,d0
  90.         move.b  subtype(a0),d0
  91.         lsl.b   #5,d0
  92.         move.b  d0,orbo_angle(a0)
  93.  
  94.         ; mapping
  95.         lea ObjDat3_Orbinaut_Orb(pc),a1
  96.         jsr (SetUp_ObjAttributes3).w
  97.         clr.b   routine(a0)
  98.         move.b  #4,orbo_radius(a0)
  99.         move.l  #.main,address(a0)
  100.  
  101. .main
  102.         movea.w parent3(a0),a1
  103.         cmpi.b  #2,mapping_frame(a1)                ; is orbinaut angry?
  104.         bne.s   .circle                         ; if not, branch
  105.         tst.b   orbo_angle(a0)                      ; is spikeorb directly under the orbinaut?
  106.         bne.s   .circle                         ; if not, branch
  107.         move.l  #.move,address(a0)
  108.         subq.b  #1,orb_count(a1)
  109.         bpl.s   .fire
  110.         move.l  #Obj_Orbinaut.move,address(a1)
  111.  
  112. .fire
  113.         move.w  #-$200,x_vel(a0)                    ; move orb to the left (quickly)
  114.         btst    #0,status(a1)
  115.         beq.s   .move
  116.         neg.w   x_vel(a0)
  117.  
  118. .move
  119.         jsr (MoveSprite2).w
  120.         jmp (Sprite_CheckDeleteTouchXY).w
  121. ; ---------------------------------------------------------------------------
  122.  
  123. .circle
  124.         move.b  orb_rotation(a1),d0
  125.         sub.b   d0,orbo_angle(a0)
  126.         move.b  orbo_radius(a0),d2
  127.         jsr (MoveSprite_CircularSimple).w
  128.         jmp (Child_DrawTouch_Sprite).w
  129.  
  130. ; =============== S U B R O U T I N E =======================================
  131.  
  132. ObjDat_Orbinaut:            subObjData Map_Orb, $55B, $200, 24/2, 24/2, 0, $B
  133. ObjDat3_Orbinaut_Orb:   subObjData3 $200, 16/2, 16/2, 3, $18|$80
  134.  
  135. ChildObjDat6_Orbinaut_Orb:
  136.         dc.w 4-1
  137.         dc.l Obj_Orbinaut_Orb
  138. ; ---------------------------------------------------------------------------
  139.  
  140.         include "Objects/Orbinaut/Object Data/Anim - Orbinaut.asm"
  141.         include "Objects/Orbinaut/Object Data/Map - Orbinaut.asm"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement