diff options
author | Astatin <[email protected]> | 2025-01-22 18:20:43 +0900 |
---|---|---|
committer | Astatin <[email protected]> | 2025-01-22 18:20:43 +0900 |
commit | 57326c9acf9cbb025d54093fb90fd70614659400 (patch) | |
tree | c8f396d56119fbfba1718e1891b9e9bd659f698f | |
parent | 02038990a93c0b4cf58269b5456327ea64b998b7 (diff) |
Add laser animation and change animation steps to decrement
-rw-r--r-- | animation.gbasm | 6 | ||||
-rw-r--r-- | animations/laser.gbasm | 124 | ||||
-rw-r--r-- | animations/rotatingball.gbasm | 10 | ||||
-rw-r--r-- | animations/sparkles.gbasm | 8 | ||||
-rw-r--r-- | enemiesattacks/basic.gbasm | 44 | ||||
-rw-r--r-- | map/objects.gbasm | 1 | ||||
-rw-r--r-- | playerattacks/earcoptr.gbasm | 1 | ||||
-rw-r--r-- | playerattacks/heal.gbasm | 1 |
8 files changed, 164 insertions, 31 deletions
diff --git a/animation.gbasm b/animation.gbasm index a10b01e..1307796 100644 --- a/animation.gbasm +++ b/animation.gbasm @@ -9,6 +9,7 @@ Display_Animation: PUSH HL LD A, (HL) + AND $3f LD BC, =Animation_Jump_table .JUMP_TABLE @@ -19,7 +20,7 @@ Display_Animation: RET -Try_Launch_Animation: ; XY in BC, jump_table index in A +Try_Launch_Animation: ; XY in BC, jump_table index in A, number of steps in E PUSH HL PUSH AF @@ -60,7 +61,7 @@ Try_Launch_Animation: ; XY in BC, jump_table index in A LD (HL+), A LD A, C LD (HL+), A - XOR A + LD A, E LD (HL+), A POP HL @@ -88,3 +89,4 @@ Animation_Jump_table: .INCLUDE "animations/sparkles.gbasm" .INCLUDE "animations/rotatingball.gbasm" +.INCLUDE "animations/laser.gbasm" diff --git a/animations/laser.gbasm b/animations/laser.gbasm new file mode 100644 index 0000000..fba2df4 --- /dev/null +++ b/animations/laser.gbasm @@ -0,0 +1,124 @@ +Laser_Animation: + INC HL + + LD A, (HL+) + ADD $80 + LD D, A + LD A, $mem_viewport_x + LD B, A + SUB $82 + CP D + RET NC + ADD $0e + CP D + RET C + LD A, D + SUB $80 + SUB B + AND $0f + SWAP A + LD B, A + + LD A, (HL+) + ADD $80 + LD D, A + LD A, $mem_viewport_y + LD C, A + SUB $82 + CP D + RET NC + ADD $0d + CP D + RET C + LD A, D + SUB $80 + SUB C + AND $0f + SWAP A + ADD $06 + LD C, A + + LD E, (HL) + DEC E + DEC E + CP E + JP C, =.End_animation + LD (HL), E + + DEC HL + DEC HL + DEC HL + LD A, (HL+) + SWAP A + SRA A + SRA A + AND $03 + INC A + LD D, A + + LD A, $04 + ADD B + LD B, A + + LD A, $04 + ADD C + LD C, A + + LD A, $0f + AND E + CP $00 + JR NZ =.Skip_move_animation_tile + + PUSH BC + + LD B, (HL) + INC HL + LD C, (HL) + + LD A, $01 + .ADD_A_TO_DIRECTION_BC + + LD (HL), C + DEC HL + LD (HL), B + + POP BC + + .Skip_move_animation_tile: + + LD A, $0f + AND E + CPL + INC A + ADD $0f + + .ADD_A_TO_DIRECTION_BC + + .ADD_MOVING_ANIMATION_OFFSET + + PUSH HL + LD HL, $mem_oam_buffer + LD A, $mem_oam_buffer_low + LD L, A + ADD $08 + LD $mem_oam_buffer_low, A + + LD A, C + LD (HL+), A + + LD A, B + LD (HL+), A + LD A, $64 + LD (HL+), A + LD A, $00 + LD (HL+), A + + POP HL + RET + + .End_animation: + LD A, L + AND $fc + LD L, A + LD (HL), $00 + RET diff --git a/animations/rotatingball.gbasm b/animations/rotatingball.gbasm index cbc2776..2d89cbe 100644 --- a/animations/rotatingball.gbasm +++ b/animations/rotatingball.gbasm @@ -42,12 +42,14 @@ Rotating_Ball_Animation: LD C, A LD E, (HL) - INC E - LD A, $2f + DEC E CP E - JP C, =Rotating_Ball.End_animation + JP C, =.End_animation LD (HL), E + LD A, $30 + SUB E + LD E, A LD A, E AND $0f @@ -85,7 +87,7 @@ Rotating_Ball_Animation: POP HL RET - Rotating_Ball.End_animation: + .End_animation: LD A, L AND $fc LD L, A diff --git a/animations/sparkles.gbasm b/animations/sparkles.gbasm index 018cf27..166332c 100644 --- a/animations/sparkles.gbasm +++ b/animations/sparkles.gbasm @@ -40,14 +40,14 @@ Sparkle_Animation: LD C, A LD E, (HL) - INC E - LD A, $1f - AND E - LD E, A + DEC E XOR A CP E JP Z, =.End_animation LD (HL), E + LD A, $20 + SUB E + LD E, A .ADD_MOVING_ANIMATION_OFFSET diff --git a/enemiesattacks/basic.gbasm b/enemiesattacks/basic.gbasm index 882b1ae..64805eb 100644 --- a/enemiesattacks/basic.gbasm +++ b/enemiesattacks/basic.gbasm @@ -3,28 +3,30 @@ Basic_Attack: ; Direction to face in E. Result in BC (XY), Direction in D OR $10 LD D, A - LD A, $01 - LD $mem_bunny_status, A - LD A, $02 - LD $mem_bunny_flags, A - LD A, $mem_bunny_direction - AND $07 - LD $mem_bunny_direction, A - CALL =Fix_Bunny_screen + ; For Future Attacks: This is an attack that would freeze the bunny and move -4 x the entity + ; LD A, $01 + ; LD $mem_bunny_status, A + ; LD A, $02 + ; LD $mem_bunny_flags, A + ; LD A, $mem_bunny_direction + ; AND $07 + ; LD $mem_bunny_direction, A + ; CALL =Fix_Bunny_screen - LD A, B - SUB $04 - LD B, A - ; LD A, $mem_bunny_health - ; SUB $01 - ; JR C, =.health_underflow_fix - ; DAA - ; LD $mem_bunny_health, A - ; JR =.Skip_health_underflow_fix + ; LD A, B + ; SUB $04 + ; LD B, A - ; .health_underflow_fix: - ; LD A, $00 - ; LD $mem_bunny_health, A - ; .Skip_health_underflow_fix: + LD A, $mem_bunny_health + SUB $01 + JR C, =.health_underflow_fix + DAA + LD $mem_bunny_health, A + JR =.Skip_health_underflow_fix + + .health_underflow_fix: + LD A, $00 + LD $mem_bunny_health, A + .Skip_health_underflow_fix: RET diff --git a/map/objects.gbasm b/map/objects.gbasm index ae62b8e..9f0af1f 100644 --- a/map/objects.gbasm +++ b/map/objects.gbasm @@ -156,6 +156,7 @@ Heal_Action: LD A, $mem_bunny_y LD C, A LD A, $01 + LD E, $20 CALL =Try_Launch_Animation POP BC diff --git a/playerattacks/earcoptr.gbasm b/playerattacks/earcoptr.gbasm index 7e74802..123ec86 100644 --- a/playerattacks/earcoptr.gbasm +++ b/playerattacks/earcoptr.gbasm @@ -72,6 +72,7 @@ Earcoptr_Attack: LD A, $mem_bunny_y LD C, A LD A, $02 + LD E, $30 CALL =Try_Launch_Animation POP BC diff --git a/playerattacks/heal.gbasm b/playerattacks/heal.gbasm index 281726a..789afac 100644 --- a/playerattacks/heal.gbasm +++ b/playerattacks/heal.gbasm @@ -14,6 +14,7 @@ Heal_Attack: LD A, $mem_bunny_y LD C, A LD A, $01 + LD E, $20 CALL =Try_Launch_Animation POP BC |