Browse Source

Spawn player at map spawn

master
Forest Belton 3 years ago
parent
commit
e9b3a49054
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      src/map.s

+ 19
- 0
src/map.s View File

@ -47,6 +47,25 @@ Map_Load::
ld d, CURRENT_DATA_END - CURRENT_DATA_START ld d, CURRENT_DATA_END - CURRENT_DATA_START
call memcpy call memcpy
; Move player to spawn point
ld a, [CURRENT_CAMERA_X]
ld b, a
ld a, [CURRENT_SPAWN_X]
sub b
sla a
sla a
sla a
ld [PLAYER_X], a
ld a, [CURRENT_CAMERA_Y]
ld b, a
ld a, [CURRENT_SPAWN_Y]
sub b
sla a
sla a
sla a
ld [PLAYER_Y], a
; Write tiles to VRAM ; Write tiles to VRAM
ld hl, CURRENT_TILE_PTR ld hl, CURRENT_TILE_PTR
ld a, [hl+] ld a, [hl+]

Loading…
Cancel
Save