ASM to Sega Genesis Platform

All about assembly programming in the Sega Genesis console.


    Homing Attack in Sonic 1 - Step 2 - Enemy List

    Share

    OuricoDoido
    Admin

    Mensagens : 46
    Data de inscrição : 2011-01-09
    Current Project : Sonic Open Source Project

    Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  OuricoDoido on Tue Jan 25, 2011 4:34 pm

    We need create a list with which objects the Sonic can attack, here's the main difference of the Homing Attack and the Light Dash (the Light Dash only move the Sonic in ring direction).

    Modify this code to get it ready for the enemy list:
    Code:
    HA_enemylist:
          tst.b   (a1)            ; is a Null object
          bne.s   HA_calcdistance      ; if not, branch
    To this:
    Code:
    HA_enemylist:
          tst.b   (a1)         ; is a Null object
          beq.s   HA_nextobject   ; if yes, branch
    Why this modification?
    If you look, you see that the old code, all not null objects may be chased by Sonic, but in new code, if is a null objects, search for another object, and if not, unlike the old code, the code continues with the enemy list that we will add.


    Now below these lines:
    Code:
    HA_enemylist:
          tst.b   (a1)         ; is a Null object
          beq.s   HA_nextobject   ; if yes, branch
    Add the list:
    Code:
          cmpi.b   #5,$20(a1)      ; is not an enemy object? (spring, explosion, platform, collected ring, flame thrower (SBZ), among others)
          bcs.w   HA_nextobject   ; if yes, branch
          ; cmpi.b   #5,$20(a1)      ; is Burrobot enemy (LZ)
          ; beq.w   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #6,$20(a1)      ; is Crabmeat enemy (GHZ, SYZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #8,$20(a1)      ; is Buzz Bomber enemy (GHZ, MZ, SYZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #9,$20(a1)      ; is Chopper enemy (GHZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$A,$20(a1)   ; is Jaws enemy (LZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$B,$20(a1)   ; is Caterkiller enemy (MZ, SBZ) / Orbinaut enemy (LZ, SLZ, SBZ) / Basaran enemy (MZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$C,$20(a1)   ; is Roller enemy (SYZ) / Newtron enemy (GHZ)
          ; beq.s   HA_calcdistance   ; if yes, branch   
          ; cmpi.b   #$D,$20(a1)   ; is Newtron enemy (GHZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$E,$20(a1)   ; is Roller enemy (SYZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$F,$20(a1)   ; is Eggman
          ; beq.s   HA_calcdistance   ; if yes, branch
          cmpi.b   #$F,$20(a1)      ; is some enemy of the list above?
          bls.s   HA_calcdistance ; if yes, branch
          cmpi.b   #$46,$20(a1)   ; is the monitor?
          beq.s   HA_calcdistance ; if yes, branch
          ; cmpi.b   #$47,$20(a1)      ; is the ring?
          ; beq.s   HA_calcdistance       ; if yes, branch
          cmpi.b   #$52,$20(a1)   ; is giant ring for entry to special stage?
          beq.s   HA_calcdistance ; if yes, branch
          cmpi.b   #$CC,$20(a1)   ; is Yadrin enemy (SYZ)
          beq.s   HA_calcdistance ; if yes, branch
    To find more objects search per ",$20(a" without quotes.
    This list is to the objects the Sonic can attack, the Bomb enemy per example, is out of the list, because is not good attack it.


    Why work with the "touch response number"?
    Because is more easy than work with the object number (that goes more or less until $8C), the game itself uses the "touch response number" to know if is a enemy, monitor, and other objects.

    In the Homing Attack we use the same principle, mainly, we need to attack the enemy, and a variable that encompasses all enemies is the "touch response number". Thus, instead of program several lines, one for each object, we can program a line for all (with the exception of Yadrin enemy).
    avatar
    calebjhuhlu

    Mensagens : 55
    Data de inscrição : 2011-06-16

    Re: Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  calebjhuhlu on Fri Jun 24, 2011 5:55 am

    How can we make it to where you can do a homing attack on a Bounce Spring, like in sonic 4?
    avatar
    Green Snake

    Mensagens : 2094
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  Green Snake on Sun May 19, 2013 11:12 am

    OuricoDoido wrote:We need create a list with which objects the Sonic can attack, here's the main difference of the Homing Attack and the Light Dash (the Light Dash only move the Sonic in ring direction).

    Modify this code to get it ready for the enemy list:
    Code:
    HA_enemylist:
          tst.b   (a1)            ; is a Null object
          bne.s   HA_calcdistance      ; if not, branch
    To this:
    Code:
    HA_enemylist:
          tst.b   (a1)         ; is a Null object
          beq.s   HA_nextobject   ; if yes, branch
    Why this modification?
    If you look, you see that the old code, all not null objects may be chased by Sonic, but in new code, if is a null objects, search for another object, and if not, unlike the old code, the code continues with the enemy list that we will add.


    Now below these lines:
    Code:
    HA_enemylist:
          tst.b   (a1)         ; is a Null object
          beq.s   HA_nextobject   ; if yes, branch
    Add the list:
    Code:
          cmpi.b   #5,$20(a1)      ; is not an enemy object? (spring, explosion, platform, collected ring, flame thrower (SBZ), among others)
          bcs.w   HA_nextobject   ; if yes, branch
          ; cmpi.b   #5,$20(a1)      ; is Burrobot enemy (LZ)
          ; beq.w   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #6,$20(a1)      ; is Crabmeat enemy (GHZ, SYZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #8,$20(a1)      ; is Buzz Bomber enemy (GHZ, MZ, SYZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #9,$20(a1)      ; is Chopper enemy (GHZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$A,$20(a1)   ; is Jaws enemy (LZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$B,$20(a1)   ; is Caterkiller enemy (MZ, SBZ) / Orbinaut enemy (LZ, SLZ, SBZ) / Basaran enemy (MZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$C,$20(a1)   ; is Roller enemy (SYZ) / Newtron enemy (GHZ)
          ; beq.s   HA_calcdistance   ; if yes, branch   
          ; cmpi.b   #$D,$20(a1)   ; is Newtron enemy (GHZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$E,$20(a1)   ; is Roller enemy (SYZ)
          ; beq.s   HA_calcdistance   ; if yes, branch
          ; cmpi.b   #$F,$20(a1)   ; is Eggman
          ; beq.s   HA_calcdistance   ; if yes, branch
          cmpi.b   #$F,$20(a1)      ; is some enemy of the list above?
          bls.s   HA_calcdistance ; if yes, branch
          cmpi.b   #$46,$20(a1)   ; is the monitor?
          beq.s   HA_calcdistance ; if yes, branch
          ; cmpi.b   #$47,$20(a1)      ; is the ring?
          ; beq.s   HA_calcdistance       ; if yes, branch
          cmpi.b   #$52,$20(a1)   ; is giant ring for entry to special stage?
          beq.s   HA_calcdistance ; if yes, branch
          cmpi.b   #$CC,$20(a1)   ; is Yadrin enemy (SYZ)
          beq.s   HA_calcdistance ; if yes, branch
    To find more objects search per ",$20(a" without quotes.
    This list is to the objects the Sonic can attack, the Bomb enemy per example, is out of the list, because is not good attack it.


    Why work with the "touch response number"?
    Because is more easy than work with the object number (that goes more or less until $8C), the game itself uses the "touch response number" to know if is a enemy, monitor, and other objects.

    In the Homing Attack we use the same principle, mainly, we need to attack the enemy, and a variable that encompasses all enemies is the "touch response number". Thus, instead of program several lines, one for each object, we can program a line for all (with the exception of Yadrin enemy).
    avatar
    Green Snake

    Mensagens : 2094
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  Green Snake on Sun May 19, 2013 11:24 am

    avatar
    Green Snake

    Mensagens : 2094
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  Green Snake on Sun May 19, 2013 11:25 am

    avatar
    hacker___

    Mensagens : 1967
    Data de inscrição : 2013-05-06
    Localização : Antarctica
    Current Project : Sonic Random Hax

    Re: Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  hacker___ on Fri Sep 27, 2013 8:15 pm

    calebjhuhlu wrote:How can we make it to where you can do a homing attack on a Bounce Spring, like in sonic 4?
    hax

    Sponsored content

    Re: Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  Sponsored content


      Current date/time is Sun Dec 10, 2017 8:57 pm