Skip to content
This repository was archived by the owner on Sep 21, 2025. It is now read-only.

Commit ba6e6aa

Browse files
committed
Transition Fix
Remove offscreen Monsters during transitions.
1 parent 2c53751 commit ba6e6aa

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

Engine/GameModes/Level.asm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ Level_TransitionUp:
514514
ld a,[Engine_CameraY]
515515
sub SCRN_Y/16
516516
ld [Engine_CameraY],a
517+
call TransitionUpdateMonsters
517518
call BeginSprites
518519
call DrawPlayer
519520
call RenderMonsters
@@ -570,6 +571,7 @@ Level_TransitionDown:
570571
ld a,[Engine_CameraY]
571572
add SCRN_Y/16
572573
ld [Engine_CameraY],a
574+
call TransitionUpdateMonsters
573575
call BeginSprites
574576
call DrawPlayer
575577
call RenderMonsters

Engine/Object.asm

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
; Object System
33
; ==============
44

5-
; TODO
6-
; - Object Behaviors
7-
85
section "Object Memory",wram0
96

107
MONSTER_COUNT equ 16 ; maximum number of monster slots
@@ -1508,6 +1505,33 @@ UpdateMonsters:
15081505
ld [Engine_CurrentScreen],a
15091506
ret
15101507
1508+
TransitionUpdateMonsters:
1509+
ld b,0
1510+
ld c,MONSTER_COUNT-1
1511+
ld a,[Engine_CameraY]
1512+
ld d,a
1513+
.updateLoop:
1514+
ld hl,Monster_ID
1515+
add hl,bc
1516+
ld a,[hl]
1517+
or a
1518+
jr z,.nextMonster
1519+
ld hl,Monster_YPosition
1520+
add hl,bc
1521+
ld a,[hl]
1522+
cp d
1523+
jr c,.removeMonster
1524+
sub SCRN_Y
1525+
cp d
1526+
jr c,.nextMonster
1527+
.removeMonster:
1528+
call DeleteMonster
1529+
.nextMonster:
1530+
dec c
1531+
bit 7,c
1532+
jr nz,.updateLoop
1533+
ret
1534+
15111535
; Update Monster animations
15121536
AnimateMonsters:
15131537
ld b,0

0 commit comments

Comments
 (0)