Bug with my autotiling system when I replace a tile [Solved]

Fayabella

  • Posts: 92
Hi,

I'm using a method called bitmasking to autotile my dirt.
Attached is a picture of the problem and of my code.
I've troubleshot all I can and can't find a problem.
When I click, it replaces a grass tile with a dirt tile and then triggers the autotiling. However, for some reason, if I click in a specific configuration, I get a graphical bug. What do you think is wrong? (The top, left, bottom and centre were clicked first, then the right one. The middle one should be an 'all 4 corners' tile.)

If you need the .stencyl to troubleshoot further, let me know.

Thanks!

« Last Edit: February 13, 2019, 06:38:30 pm by Fayabella »

rob1221

  • *
  • Posts: 9349
Stencyl has an autotile feature but it doesn't have a GUI implemented so it can only be done through XML.  If that's something you're interested in you can check this post: http://community.stencyl.com/index.php/topic,37752.msg242356.html#msg242356

Fayabella

  • Posts: 92
I've seen that and I don't understand it, nor do I have a tileset that is in the right format.


Fayabella

  • Posts: 92
Bump.

Would sharing the stencyl file help perhaps?


rob1221

  • *
  • Posts: 9349
Do you think this is a Stencyl bug?  To me it just seems like the wrong tile is being selected.

Fayabella

  • Posts: 92
It happens consistently when I delete a tile like... Well, let me show you.
Say X is a grass tile, and O is a dirt tile.
-- is where I click.

X X O
X -- O O
X X O

The tile is surrounded on all sides except for one (including corners of that side)
This can be any side, I'm just choosing the right side for an example.
There is also a dirt tile to the right of the dirt tile directly to the right of the clicked tile.

It's always when it's surrounded and there's another dirt 2 tiles in the direction of the empty side.

Hope that makes sense.
I believe it is a problem with my script somewhere, and probably not a Stencyl problem.

Fayabella

  • Posts: 92
If you'd like to test for yourself, I've uploaded the game to http://www.stencyl.com/game/play/39890
Click to delete tiles. There's a pattern of when they mess up,  and it seems that the tile that messes up is not updated for whatever reason.

rob1221

  • *
  • Posts: 9349
It happens a lot.  I'm guessing that when you check the neighboring tiles to change them, you aren't taking into account all possible tiles at those locations.

Fayabella

  • Posts: 92
I appear to have fixed it. It was actually an updating problem, it seems that the tiles that were messed up were not being checked as autotilable tiles, so instead I just made the Autotiling event repeat once after it initially does it, and also added a loop that changes all grass-edge tiles into normal dirt tiles (un-autotiling it all) before it checks for autotiling.

Strange. I'm not sure why it wasn't updating  ???