fix map collision
This commit is contained in:
parent
bc109bcf11
commit
461fa980d7
|
@ -225,10 +225,9 @@ class Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
draw() {
|
draw() {
|
||||||
if (!_alive) {
|
if (_alive) {
|
||||||
return
|
|
||||||
}
|
|
||||||
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) {
|
for (b in _bullets) {
|
||||||
b.draw()
|
b.draw()
|
||||||
}
|
}
|
||||||
|
@ -467,7 +466,7 @@ class World {
|
||||||
}
|
}
|
||||||
|
|
||||||
fgCheck(x, y) {
|
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 mapY = (y / TileSize) + _world_y
|
||||||
var tile = TIC.mget(mapX, mapY)
|
var tile = TIC.mget(mapX, mapY)
|
||||||
if (tile == 0) {
|
if (tile == 0) {
|
||||||
|
|
Loading…
Reference in a new issue