Swap world tiles

Hello, I just wanted to know if there was a way to swap world tiles with each other.

like, the one the player can stand on. Swapping the tiles from white to black

1 Like

This is a nice easy one:

You can call swap "TileName" from the tile itself or in a function or event.
"TileName" being whatever the tile you want to swap to is called.

In the collected function for an item tile this might look like:

on collect do
//swap the tile for "black" if such a tile name exists
swap "black"
//Then print "Swapped a tile" to the screen to make sure this is being called
say "Swapped a tile"
end

Have a look here in the docs:

2 Likes

But world tiles don't have scripts you can attach to them. I've tried to do this:

for sprite0:

on interact do
  tell "floor" to
    swap "lava"
  end
end

in an attempt to swap tiles that aren't the item, but I haven't been able to get this working so far.

You need to reference a tile by its coordinates to swap it. It doesn't matter if its a world tile at those coordinates.

e.g.

tell 12,7 to
  swap "lava"
end