Skip to content

Commit

Permalink
Death animation fix
Browse files Browse the repository at this point in the history
Fixed death animation when Snek hits herself.
Also added a new check for the win state just in case.
  • Loading branch information
LeonarthCG committed Aug 20, 2018
1 parent a01bfd9 commit a2c0077
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Binary file modified ASM/Snake/moveSnake.elf
Binary file not shown.
2 changes: 1 addition & 1 deletion ASM/Snake/moveSnake.s
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ b End
doGrow:
ldrh r3,[r4]
add r3,#1
strh r3,[r4]
@check if the snake is going to hit herself
push {r0-r3}
mov r0,r1
Expand All @@ -204,6 +203,7 @@ strh r0,[r4,#0x1A]
ldrh r0,[r4,#0x16]
sub r0,#1
strh r0,[r4,#0x16]
strh r3,[r4]
b End

End:
Expand Down
Binary file modified ASM/mainLoop.elf
Binary file not shown.
20 changes: 19 additions & 1 deletion ASM/mainLoop.s
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ b skipSnake
runSnake:
strh r3,[r0,#0x18] @update counter

@check for win
ldrb r3,[r0,#0xD]
cmp r3,#0xFE
bne notWIN1
b WIN
notWIN1:

@check for game over
ldrb r3,[r0,#0xD]
cmp r3,#0xFF
Expand All @@ -272,9 +279,16 @@ ldr r0,=moveSnake
mov lr,r0
.short 0xF800

@check for game over
@check for win
ldr r0,=#0x02000000
ldrb r3,[r0,#0xD]
cmp r3,#0xFE
bne notWIN2
b WIN
notWIN2:

@check for game over
ldrb r3,[r0,#0xD]
cmp r3,#0xFF
beq gameover

Expand Down Expand Up @@ -443,3 +457,7 @@ ldr r3,=#0x04000100
ldrh r3,[r3,#4] @counter
strh r3,[r0,#0x18] @counter last time logic was ran
b main

WIN:
swi #5
b WIN
Binary file modified rom.gba
Binary file not shown.

0 comments on commit a2c0077

Please sign in to comment.