Well, time to fix the billion issues I have with tile collisions and such.
Firstly, I need to fix fog of war, which is now somewhat broken. The complication was having wall side and top have separate visibility. Now I’m back to single per-tile visibility flag. And any wall/door (technically, anything that isn’t floor) also reveal the tile above it:
I hope I’m never touching this again.
Tile themselves are now perfect squares with no overlay and implied depth weirdness. This means all my collisions can work of standard numbers. For example, top and bottom collisions are exactly half the collision side (darker and lighter horizontal lines are of matching collision distance):
And, since my sprites are “slanted”, I can have the side collision have a different collision distance, namely 2/3 here:
These are now math-perfect values as expected from the collision size. I hope I don’t have to touch these either again. I do have to make sure to design mobs and animations so their sprites don’t appear outside their collision size values though, otherwise they will overlap unruly into walls. But it’s not that bad if it happens (as opposed to clipping). For example, shooting “into” a wall isn’t that bad as it was:
There is however weirdness with effects. The “bottom” and “side” wall hits are fine:
But “top” wall hits are not visually accurate:
Basically, this top wall is the only time when something is supposed visually overlap it and that’s projectiles and any effects they spawn. But the issue is that it is only projectiles and effects. I hate hard-coding this stuff, but I am not sure how else to solve it. And it gets worse if I add elevation to these to account for being above ground.
Anyway, I am adding a flag to projectiles to specify they have special interaction logic with walls:
I only need this for projectiles, because effects spawn where the projectiles hit, so they are dependent on projectiles and don’t need their own extra rules. And this works nice, I can add a hard-coded offset for when the collision registers for tile collision checks:
Here, the top wall has almost half a tile leeway for collision, meaning that it collides “mid-tile”, which visually means it hits “on the wall”. Yay! As before, hope I never have to touch this again.
My doors are really wide now. In fact, the vertical and horizontal sizes don’t match and it doesn’t really make sense when you think about it. But it doesn’t really matter. Closed doors are (usually) just 1 wide and open doors sort of blend with the rest:
In short, I’m no adding any exceptional logic to this.
I also had to fix door locking (for when boss battles start) and unlocking, with correct tile changes (since technically tiles have no “memory” of their sprites after/before transformation). Some of the double-door stuff, especially the neighbouring door tiles being a different room/area, had issues, so I had to fix those.
I can apply a bit of that top-down door stuff for this where the door is actually slightly slanted:
It does mean that the doors have to match the walls, but that’s kind of expected anyway from the same room. There will be slight transition weirdness if the neighboring room is a different style.
Of course, I’m not going to animate anything at the moment (and probably ever).
Also here’s some new impacts for blaster projectile:
Anyway, a shorter blog for various fixes that don’t go elsewhere.