This allows tile collision to sample more points for better collision detection.
; bottom left point
_act_tile_col_check col_point_bl, (-1 & 0xFF), 0, @collision
+ ; center left point
+ _act_tile_col_check col_point_lc, (-1 & 0xFF), 0, @collision
+
pop de
xor a, a
ret
; bottom right point
_act_tile_col_check col_point_br, (-1 & 0xFF), 0, @collision
+ ; center right point
+ _act_tile_col_check col_point_rc, (-1 & 0xFF), 0, @collision
+
pop de
xor a, a
ret
; top right point
_act_tile_col_check col_point_tr, 0, (-1 & 0xFF), @collision
+ ; top center point
+ _act_tile_col_check col_point_tc, 0, (-1 & 0xFF), @collision
+
pop de
xor a, a
ret
; bottom rihgt point
_act_tile_col_check col_point_br, 0, (-1 & 0xFF), @collision
+ ; bottom center point
+ _act_tile_col_check col_point_bc, 0, (-1 & 0xFF), @collision
+
pop de
xor a, a
ret
; using the debug sprite
; if enabled
debug_draw_collision:
- ld a, 5
+ ld a, 9
call oamalloc
; draw each point
debug_draw_point col_point_br
debug_draw_point col_point_ct
+ debug_draw_point col_point_tc
+ debug_draw_point col_point_bc
+ debug_draw_point col_point_lc
+ debug_draw_point col_point_rc
+
ret
add a, 14
ld [col_point_br], a
ld a, c
- add a, 14
+ add a, 12
ld [col_point_br+1], a
; center point
add a, 8
ld [col_point_ct], a
ld a, c
- add a, 4
+ add a, 7
ld [col_point_ct+1], a
+ ; top center point
+ ld a, b
+ add a, 2
+ ld [col_point_tc], a
+ ld a, c
+ add a, 7
+ ld [col_point_tc+1], a
+
+ ; bottom center point
+ ld a, b
+ add a, 14
+ ld [col_point_bc], a
+ ld a, c
+ add a, 7
+ ld [col_point_bc+1], a
+
+ ; left center point
+ ld a, b
+ add a, 8
+ ld [col_point_lc], a
+ ld a, c
+ add a, 2
+ ld [col_point_lc+1], a
+
+ ; right center point
+ ld a, b
+ add a, 8
+ ld [col_point_rc], a
+ ld a, c
+ add a, 12
+ ld [col_point_rc+1], a
+
ret
; updates the special player actor
; collision related data
; y/x positions
+
+ ; corner points
+ ; used for actor -> actor center collision
+ ; should form a rectangle
+ ; also used for tile collision
+ ;
+ ; top left, top right
+ ; bottom left, bottom right
col_point_tl: .adv 2
col_point_tr: .adv 2
col_point_bl: .adv 2
col_point_br: .adv 2
+
+ ; mid points
+ ; top, bottom, left, right center
+ ; used for tile collision
+col_point_tc: .adv 2
+col_point_bc: .adv 2
+col_point_lc: .adv 2
+col_point_rc: .adv 2
+
; center point of the actor
; this is used to check for actor -> actor collision
col_point_ct: .adv 2
+
+
; direction the movement is happening
; in. this is required so that the collision code
; can handle pushbacks in case of wall collision