~nytpu/ankano unlisted

da31db5c388a3f843e1bde029528c191a374c119 — nytpu 3 months ago d2e1961
add useful defines and use them
2 files changed, 9 insertions(+), 4 deletions(-)

M include/defines.asm
M src/player.asm
M include/defines.asm => include/defines.asm +5 -0
@@ 29,6 29,11 @@ INCLUDE "hardware.inc/hardware.inc"
	end_struct
*/


PLAYSPACE_WIDTH equ SCRN_X - 32
PLAYER_WIDTH equ 8 * 3 ; three sprites wide
PLAYER_HEIGHT equ 8 ; one sprite tall

; a couple more hardware defines
NB_SPRITES equ 40


M src/player.asm => src/player.asm +4 -4
@@ 15,12 15,12 @@ InitPlayer::

	ld a, SCRN_Y - 12
	ld [Player_YPos], a
	add 8
	add PLAYER_HEIGHT ; one sprite tall
	ld [Player_YBox], a

	ld a, ((SCRN_X - 32) / 2) - 4
	ld a, (PLAYSPACE_WIDTH / 2) - 4
	ld [Player_XPos], a
	add 8 * 3
	add PLAYER_WIDTH ; three sprites wide
	ld [Player_XBox], a

	xor a


@@ 38,7 38,7 @@ ENDR
; destroy a, b, c, h, l
PlayerHandler::
	ld hl, Player_XPos
	ld a, SCRN_X - 56
	ld a, PLAYSPACE_WIDTH - PLAYER_WIDTH
	cp [hl]
	jr nc, .withinBounds_R
	ld [hl], a