Skip to content

Commit

Permalink
Heck
Browse files Browse the repository at this point in the history
Added a death animation
  • Loading branch information
LeonarthCG committed Aug 20, 2018
1 parent d6b1fc5 commit a01bfd9
Show file tree
Hide file tree
Showing 6 changed files with 317 additions and 9 deletions.
Binary file modified ASM/Snake/killSnake.elf
Binary file not shown.
212 changes: 212 additions & 0 deletions ASM/Snake/killSnake.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,218 @@
.thumb
push {lr}
push {r4-r6}

ldr r6,=drawTile

@first, figure out which one of the four animations is going to be used, based on snek position
ldr r3,=#0x02000000
ldrh r2,[r3]
lsl r2,#1
add r2,#0x20
sub r2,#2
ldrb r4,[r3,r2]
add r2,#1
ldrb r5,[r3,r2]

@jump to a label based on the snake head position
cmp r4,#0xF
bhi rightSide
cmp r5,#0xC
bhi leftLower
b leftUpper
rightSide:
cmp r5,#0xC
bhi rightLowerTrampolin
b rightUpper

rightLowerTrampolin:
b rightLower

leftUpper:
add r5,#1
mov r0,#1
ldr r1,=#0x83B
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
ldr r1,=#0x83C
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
ldr r1,=#0x83D
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#2
add r5,#1
mov r0,#1
ldr r1,=#0x837
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
ldr r1,=#0x838
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
ldr r1,=#0x839
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
b End

leftLower:
sub r5,#1
mov r0,#1
mov r1,#0x3B
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
mov r1,#0x3C
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
mov r1,#0x3D
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#2
sub r5,#1
mov r0,#1
mov r1,#0x37
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
mov r1,#0x38
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#1
mov r0,#1
mov r1,#0x39
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
b End

rightUpper:
add r5,#1
mov r0,#1
ldr r1,=#0x846
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
ldr r1,=#0x845
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
ldr r1,=#0x844
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#2
add r5,#1
mov r0,#1
ldr r1,=#0x842
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
ldr r1,=#0x841
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
ldr r1,=#0x840
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
b End

rightLower:
sub r5,#1
mov r0,#1
mov r1,#0x46
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
mov r1,#0x45
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
mov r1,#0x44
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
add r4,#2
sub r5,#1
mov r0,#1
mov r1,#0x42
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
mov r1,#0x41
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
sub r4,#1
mov r0,#1
mov r1,#0x40
mov r2,r4
mov r3,r5
mov lr,r6
.short 0xF800
b End

End:
pop {r4-r6}
pop {r0}
bx r0
Binary file modified ASM/mainLoop.elf
Binary file not shown.
103 changes: 95 additions & 8 deletions ASM/mainLoop.s
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,23 @@ ldr r3,=loadData
mov lr,r3
.short 0xF800

@set background 0 and 1 to 16 colors mode
ldr r0,=#0x04000000
mov r1,#1
strb r1,[r0,#8]
strb r1,[r0,#10]

@enable all bgs
ldr r0,=#0x04000000
mov r1,#0xF
strb r1,[r0,#1]

@lower bg 2 priority
@bg 0 priority
mov r1,#2
strb r1,[r0,#0x8]
@bg 1 priority
mov r1,#0
strb r1,[r0,#0xA]
@bg 2 priority
mov r1,#3
strb r1,[r0,#0xC]
@bg 3 priority
mov r1,#1
strb r1,[r0,#0xE]

@lower bg 3 y coord a bit
mov r1,#0x1E
Expand All @@ -77,6 +81,30 @@ ldr r3,=loadData
mov lr,r3
.short 0xF800

ldr r0,=snekIMG
ldrh r0,[r0,#2]
lsl r0,#2
ldr r1,=#0x06000000
add r1,r0
ldr r0,=heckIMG
ldr r3,=loadData
mov lr,r3
.short 0xF800

ldr r0,=snekIMG
ldrh r0,[r0,#2]
lsl r0,#2
ldr r1,=#0x06000000
add r1,r0
ldr r0,=heckIMG
ldrh r0,[r0,#2]
lsl r0,#2
add r1,r0
ldr r0,=heckmirrorIMG
ldr r3,=loadData
mov lr,r3
.short 0xF800

ldr r0,=#0x02000000
mov r1,#8
strb r1,[r0,#3] @speed
Expand Down Expand Up @@ -164,7 +192,9 @@ ldrb r1,[r0]
mov r0,#8
and r0,r1
cmp r0,#0
beq pauseGame
bne dontpauseGame
b pauseGame
dontpauseGame:

ldr r2,=#0x02000000
ldr r3,=#0x04000130
Expand Down Expand Up @@ -242,6 +272,12 @@ ldr r0,=moveSnake
mov lr,r0
.short 0xF800

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

ldr r0,=eatEgg
mov lr,r0
.short 0xF800
Expand Down Expand Up @@ -280,10 +316,61 @@ swi #5 @wait for vblank
b main

gameover:
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
@death animation
ldr r0,=killSnake
mov lr,r0
.short 0xF800
ldr r0,=#0x02000000
add r0,#0x10
mov r1,#1
strb r1,[r0,#1] @set bg 1 to be updated
ldr r0,=copyBuffers
mov lr,r0
.short 0xF800
ldr r0,=#0x02000000
add r0,#0x10
mov r1,#0
strb r1,[r0,#1] @set bg 1 to not be updated
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
swi #5
@back to title screen
ldr r0,=fadeOut
mov lr,r0
Expand Down
11 changes: 10 additions & 1 deletion ROM Buildfile.event
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ snekPAL:
SHORT 0 8
#incext png2dmp "Graphics\snek.png" --palette-only

ALIGN 4
heckIMG:
SHORT 0 64
#incext png2dmp "Graphics\heck.png"

ALIGN 4
heckmirrorIMG:
SHORT 0 64
#incext png2dmp "Graphics\heckmirror.png"

ALIGN 4
titlescreenIMG:
SHORT 0 9600
Expand Down Expand Up @@ -198,4 +208,3 @@ ALIGN 4
scoreTSA:
SHORT 0 32
#incbin "Graphics\score.tsa.bin"

Binary file modified rom.gba
Binary file not shown.

0 comments on commit a01bfd9

Please sign in to comment.