If you turn on show-collision-rectangles and show-tile-grid you'll see that you're actually standing on the out-of-map tiles. So, when you call set_tiles the player collides with the out-of-map tiles and he gets killed as part of "remove entities that collide with the set tile".
I don't have a nice solution to this because player collision is different than everything else in that: the player can walk partially on tiles it collides with.
Attachments
Capture.PNG (50.86 KiB) Viewed 1367 times
If you want to get ahold of me I'm almost always on Discord.