ASM to Sega Genesis Platform

Would you like to react to this message? Create an account in a few clicks or log in to continue.
ASM to Sega Genesis Platform

All about assembly programming in the Sega Genesis console.


5 posters

    Homing Attack in Sonic 1 - Step 2 - Enemy List

    avatar
    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 Empty Homing Attack in Sonic 1 - Step 2 - Enemy List

    Post  OuricoDoido 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).
    calebjhuhlu
    calebjhuhlu


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

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

    Post  calebjhuhlu 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?
    Green Snake
    Green Snake


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

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

    Post  Green Snake 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).
    Green Snake
    Green Snake


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

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

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

    Green Snake
    Green Snake


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

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

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

    hacker___
    hacker___


    Mensagens : 1974
    Data de inscrição : 2013-05-06
    Localização : 41.383863, 108.866009
    Current Project : Breathing nitrogen

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

    Post  hacker___ 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
    Jdpense
    Jdpense


    Mensagens : 100567
    Data de inscrição : 2014-08-21

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

    Post  Jdpense Thu Dec 27, 2018 10:40 am

    Just an annual year bump! Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy bounce bounce bounce bounce bounce affraid Basketball cheers bom drunken Basketball cheers bom drunken cherry sunny Sleep
    Green Snake
    Green Snake


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

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

    Post  Green Snake Wed Sep 04, 2019 1:57 pm


    Sponsored content


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

    Post  Sponsored content


      Current date/time is Fri Jul 26, 2024 9:17 pm