Stencyl 3.4.0 is now out. Get it now!

Find distance from specific tile,

squeeb

  • Posts: 715
How do you find the distance between an actor and a specific tile? 
Also are there any performance issues dynamically generating tiles and removing them as the game is played?  Or is there a way to change animations for tiles?

JeffreyDriver

  • Posts: 759
Might the Easy Math extension help you? There's a block that will find the distance between two XY values.  If you can get the XY value of a tile, that should work?
Current Project - www.stencyl.com/game/play/36346 (Retro Redux Dogfight).
I always appreciate useful feedback. Thank you.

www.jeffreydriver.co.uk

decafpanda

  • *
  • Posts: 100
Could you not make an invisible doodad actor and place it on the tile you want to reference?  At that point you could gain an easy reference to the actor and thus gain a reference to the tile.

Or maybe I am not fully grasping exactly what you are trying to do


squeeb

  • Posts: 715
Hmm.. I want to change the tile animation or replace a tile when the player is close to it..  thinking something of this sort.. but just replacing tiles or their animations

squeeb

  • Posts: 715
Might the Easy Math extension help you? There's a block that will find the distance between two XY values.  If you can get the XY value of a tile, that should work?
Good thinking... that may work.. I'll dig in and see what I can find.

JeffreyDriver

  • Posts: 759
You can also get the XY value of your actor and use it to check for tiles around it. I did something similar when creating a snap-to-grid movement system. See the screenshot here: http://community.stencyl.com/index.php/topic,50772.msg280695.html#msg280695
Current Project - www.stencyl.com/game/play/36346 (Retro Redux Dogfight).
I always appreciate useful feedback. Thank you.

www.jeffreydriver.co.uk

squeeb

  • Posts: 715
Ok.. I can try that way also... is there any way to change the animation of a tile with a block?. like we would an actor.. or would it be best to swap to another tile to create the 3d transition

LIBERADO

  • *
  • Posts: 2088
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

squeeb

  • Posts: 715
is there any way to change the animation of a tile with a block?
http://community.stencyl.com/index.php?issue=521.0
Yes! That's exactly what I want!  Hmm... looks like the way to do that is to create an extension with custom blocks?  Or use actor as the ground.  :/  would that be taxing on performance?

LIBERADO

  • *
  • Posts: 2088
For better performance, you could replace tiles at runtime instead of using actors as the ground.

« Last Edit: April 19, 2017, 04:18:41 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.