[SOLVED] Any possible way to check if an actor is touching a particular tileset?

undefeatedgames

  • Posts: 121
Is there any possible way to check if an actor is touching a particular tileset? If so, is there a way if he can die if he's touching that tileset?

« Last Edit: September 06, 2011, 04:10:10 pm by undefeatedgames »

coleislazy

  • *
  • Posts: 2607
Yes, but it involves a little math and a line of code. See the shot below.

Make sure you set Layer to the layer your tile is on. It is 0 by default. Tile is going to end up being a value like "0-0-2", which translates to Layer 0, Tileset 0, Tile 2. I may have the order wrong. It might be Tileset, Tile, Layer. You'll have to do some testing to see what is should be. To do that, use a print block to print Tile and see what numbers you get when you walk over your terrain.

I haven't tested this specific example, but a couple of my games use something very similar to this.

undefeatedgames

  • Posts: 121
What type of attribute did you use for Tile and Death Tile?

undefeatedgames

  • Posts: 121
It didn't work. Here's the error message I got:


Behavior: Design_281_281_Tillecollide at line 54
Access of undefined property _Tile.
            _Tile = getTileAt (_Row,_Column,_Layer);

Behavior: Design_281_281_Tillecollide at line 54
Access of undefined property _Row.
            _Tile = getTileAt (_Row,_Column,_Layer);

Behavior: Design_281_281_Tillecollide at line 54
Access of undefined property _Layer.
            _Tile = getTileAt (_Row,_Column,_Layer);

Aber

  • Posts: 33
Simplest way is to make pieces of tileset as actors of certain groups although it may degrade fps a little.

undefeatedgames

  • Posts: 121
Simplest way is to make pieces of tileset as actors of certain groups although it may degrade fps a little.
Did that. It's fine now.

coleislazy

  • *
  • Posts: 2607
It didn't work. Here's the error message I got:


Behavior: Design_281_281_Tillecollide at line 54
Access of undefined property _Tile.
            _Tile = getTileAt (_Row,_Column,_Layer);

Behavior: Design_281_281_Tillecollide at line 54
Access of undefined property _Row.
            _Tile = getTileAt (_Row,_Column,_Layer);

Behavior: Design_281_281_Tillecollide at line 54
Access of undefined property _Layer.
            _Tile = getTileAt (_Row,_Column,_Layer);

Sorry, in my editing of the post, I chopped off the part about the attributes. Tile and Death Tile should have been Text, and the others Numbers. Those error messages are because you didn't set up the attributes, or name them the same way I did. But if you got it working another way, that's cool!