fix map collision

This commit is contained in:
Fabien Freling 2021-08-15 18:10:50 +02:00
parent bc109bcf11
commit 461fa980d7

View file

@ -225,10 +225,9 @@ class Player {
}
draw() {
if (!_alive) {
return
if (_alive) {
TIC.spr(256, _x - _w / 2, _y - _h / 2, 0, 1, 0, 0, 2, 2)
}
TIC.spr(256, _x - _w / 2, _y - _h / 2, 0, 1, 0, 0, 2, 2)
for (b in _bullets) {
b.draw()
}
@ -467,7 +466,7 @@ class World {
}
fgCheck(x, y) {
var mapX = ((x + _w_offset_x) / TileSize) + _world_x
var mapX = ((x - _w_offset_x) / TileSize) + _world_x
var mapY = (y / TileSize) + _world_y
var tile = TIC.mget(mapX, mapY)
if (tile == 0) {