Difference between revisions of "Add a Homing Attack in Sonic 3 and Knuckles"
From Sonic Retro
Sonic Pro1 (talk | contribs) |
Sonic Pro1 (talk | contribs) |
||
Line 12: | Line 12: | ||
then go to ; loc_119F6: Sonic_InstaShield: | then go to ; loc_119F6: Sonic_InstaShield: | ||
+ | |||
+ | and sticks; | ||
+ | loc_119F6: | ||
+ | Sonic_InstaShield: | ||
+ | btst #Status_Shield,status_secondary(a0) ; does Sonic have an S2 shield (The Elementals were already filtered out at this point)? | ||
+ | bne.w locret_11A14 ; if yes, branch | ||
+ | btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Homing Attack? | ||
+ | move.b #0,(Shield+anim).w | ||
+ | move.b #1,double_jump_flag(a0) | ||
+ | move.w $650.d0 | ||
+ | btst #Status_Facing,status(a0) ; is Sonic facing left? | ||
+ | beq.s loc_11958 ; if not, branch | ||
+ | neg.w d0 ; reverse speed value, moving Sonic left | ||
+ | loc_11958: | ||
+ | move.w d0,x_vel(a0) ; apply velocity... | ||
+ | move.w d0,ground_vel(a0) ; ... both ground and air | ||
+ | move.w #0.y_vel(a0) ; kill y-velocity | ||
+ | move.w .$2000,(H_scroll_frame_offset).w | ||
+ | bsr.w Reset_Player_Position_Array | ||
+ | move.w '-$4A,d0; play homing-attack sound | ||
+ | jmp (Play_Sound_2).l | ||
+ | ; --------------------------------------------------------------------------- | ||
+ | |||
+ | And go higher where this is: | ||
+ | ; ---------------------------------------------------------------------------; | ||
+ | loc_1192C: | ||
+ | Sonic_FireShield: | ||
+ | |||
+ | and replace that with this: | ||
+ | |||
+ | |||
+ | ; loc_1192C: | ||
+ | Sonic_FireShield: | ||
+ | btst #Status_Invincible,status_secondary(a0) ; first, does Sonic have invincibility? | ||
+ | bne.w locret_11A14 ; if yes, branch | ||
+ | btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Fire Shield? | ||
+ | beq.s Sonic_LightningShield ; if not, branch | ||
+ | move.b #1,(Shield+anim).w | ||
+ | move.b #1,double_jump_flag(a0) | ||
+ | move.w #$800,d0 | ||
+ | btst #Status_Facing,status(a0) ; is Sonic facing left? | ||
+ | beq.s loc_8CB09 ; if not, branch | ||
+ | neg.w d0 ; reverse speed value, moving Sonic left | ||
+ | loc_8CB09: | ||
+ | move.w d0,x_vel(a0) ; apply velocity... | ||
+ | move.w d0,ground_vel(a0) ; ...both ground and air | ||
+ | move.w #0,y_vel(a0) ; kill y-velocity | ||
+ | move.w #$2000,(H_scroll_frame_offset).w | ||
+ | bsr.w Reset_Player_Position_Array | ||
+ | move.w #$43,d0 ; play Fire Shield attack sound | ||
+ | jmp (Play_Sound_2).l | ||
+ | ; --------------------------------------------------------------------------- | ||
+ | |||
+ | |||
+ | ready you already have a semi-homing attack in sonic 3 I hope you have fun and that you are happy |
Revision as of 17:05, 26 January 2021
first you must have a code editor and the dissambly: sonic 3 & knuckles
I recommend context
well you should go to sonic3k.asm
then go to ; loc_119F6: Sonic_InstaShield:
and sticks; loc_119F6: Sonic_InstaShield: btst #Status_Shield,status_secondary(a0) ; does Sonic have an S2 shield (The Elementals were already filtered out at this point)? bne.w locret_11A14 ; if yes, branch btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Homing Attack? move.b #0,(Shield+anim).w move.b #1,double_jump_flag(a0) move.w $650.d0 btst #Status_Facing,status(a0) ; is Sonic facing left? beq.s loc_11958 ; if not, branch neg.w d0 ; reverse speed value, moving Sonic left loc_11958: move.w d0,x_vel(a0) ; apply velocity... move.w d0,ground_vel(a0) ; ... both ground and air move.w #0.y_vel(a0) ; kill y-velocity move.w .$2000,(H_scroll_frame_offset).w bsr.w Reset_Player_Position_Array move.w '-$4A,d0; play homing-attack sound jmp (Play_Sound_2).l
- ---------------------------------------------------------------------------
And go higher where this is:
- ---------------------------------------------------------------------------;
loc_1192C: Sonic_FireShield:
and replace that with this:
- loc_1192C
Sonic_FireShield: btst #Status_Invincible,status_secondary(a0) ; first, does Sonic have invincibility? bne.w locret_11A14 ; if yes, branch btst #Status_FireShield,status_secondary(a0) ; does Sonic have a Fire Shield? beq.s Sonic_LightningShield ; if not, branch move.b #1,(Shield+anim).w move.b #1,double_jump_flag(a0) move.w #$800,d0 btst #Status_Facing,status(a0) ; is Sonic facing left? beq.s loc_8CB09 ; if not, branch neg.w d0 ; reverse speed value, moving Sonic left loc_8CB09: move.w d0,x_vel(a0) ; apply velocity... move.w d0,ground_vel(a0) ; ...both ground and air move.w #0,y_vel(a0) ; kill y-velocity move.w #$2000,(H_scroll_frame_offset).w bsr.w Reset_Player_Position_Array move.w #$43,d0 ; play Fire Shield attack sound jmp (Play_Sound_2).l
- ---------------------------------------------------------------------------
ready you already have a semi-homing attack in sonic 3 I hope you have fun and that you are happy