-
Notifications
You must be signed in to change notification settings - Fork 991
Collision check when Jumping a Ledge
sabra55 edited this page Jan 23, 2024
·
3 revisions
The tile that determines whether a block is walkable or not is its bottom-left tile in Pokémon Gen 1.
Table of contents:
1. Walkable
2. Not walkable
3. Walkable
4. No walkable
5. Player comparison
Check data\tilesets\collision_tile_ids.asm for walkable tiles in the overworld
tileset (gfx\tilesets\overworld.png):
MACRO coll_tiles
IF _NARG
db \# ; all args
ENDC
db -1 ; end
ENDM
Underground_Coll::
coll_tiles $0b, $0c, $13, $15, $18
-Overworld_Coll::
- coll_tiles $00, $10, $1b, $20, $21, $23, $2c, $2d, $2e, $30, $31, $33, $39, $3c, $3e, $52, $54, $58, $5b
RedsHouse1_Coll::
RedsHouse2_Coll::
coll_tiles $01, $02, $03, $11, $12, $13, $14, $1c, $1a
...
Subtitles:
Blue around tiles: walkable
Knowning this, this code add a check when jumping down a ledge.
HandleLedges in engine\overworld\ledges.asm
HandleLedges::
...
inc hl
jr .loop
.foundMatch
+ ld a, [wSpritePlayerStateData1FacingDirection]
+ cp SPRITE_FACING_DOWN
+ lda_coord 8, 13
+ jr z, .checkCollision
+ ld a, [wSpritePlayerStateData1FacingDirection]
+ cp SPRITE_FACING_LEFT
+ lda_coord 4, 9
+ jr z, .checkCollision
+ ld a, [wSpritePlayerStateData1FacingDirection]
+ cp SPRITE_FACING_RIGHT
+ lda_coord 12, 9
+ jr z, .checkCollision
+.noCollisionTile
ldh a, [hJoyHeld]
and e
ret z
...
...
ld a, SFX_LEDGE
call PlaySound
ret
+.checkCollision
+ cp $00
+ jr z, .noCollisionTile
+ cp $10
+ jr z, .noCollisionTile
+ cp $1b
+ jr z, .noCollisionTile
+ cp $20
+ jr z, .noCollisionTile
+ cp $21
+ jr z, .noCollisionTile
+ cp $23
+ jr z, .noCollisionTile
+ cp $2c
+ jr z, .noCollisionTile
+ cp $2d
+ jr z, .noCollisionTile
+ cp $2e
+ jr z, .noCollisionTile
+ cp $30
+ jr z, .noCollisionTile
+ cp $31
+ jr z, .noCollisionTile
+ cp $33
+ jr z, .noCollisionTile
+ cp $39
+ jr z, .noCollisionTile
+ cp $3c
+ jr z, .noCollisionTile
+ cp $3e
+ jr z, .noCollisionTile
+ cp $52
+ jr z, .noCollisionTile
+ cp $54
+ jr z, .noCollisionTile
+ cp $58
+ jr z, .noCollisionTile
+ cp $5b
+ jr z, .noCollisionTile
+ ret
INCLUDE "data/tilesets/ledge_tiles.asm"
...
Remove non-sense collision checks, like the houses door ($1b), cave door ($58), cut tree ($2d and $3e), right shore ($54), up shore ($33) and water pillar ($31).
HandleLegdes::
...
ld a, SFX_LEDGE
call PlaySound
ret
.checkCollision
cp $00
jr z, .noCollisionTile
cp $10
jr z, .noCollisionTile
- cp $1b
- jr z, .noCollisionTile
cp $20
jr z, .noCollisionTile
cp $21
jr z, .noCollisionTile
cp $23
jr z, .noCollisionTile
cp $2c
jr z, .noCollisionTile
- cp $2d
- jr z, .noCollisionTile
cp $2e
jr z, .noCollisionTile
cp $30
jr z, .noCollisionTile
- cp $31
- jr z, .noCollisionTile
- cp $33
- jr z, .noCollisionTile
cp $39
jr z, .noCollisionTile
cp $3c
jr z, .noCollisionTile
- cp $3e
- jr z, .noCollisionTile
cp $52
jr z, .noCollisionTile
- cp $54
- jr z, .noCollisionTile
- cp $58
- jr z, .noCollisionTile
cp $5b
jr z, .noCollisionTile
ret
INCLUDE "data/tilesets/ledge_tiles.asm"
...