Pathfinder code for lava lake

i want to try using the stratagy @kswuest uses to pathfind and avoid lava while going to the item as fast as possible. But i dont know how to use the 2d array hero.lavaMap() to help me…

1 Like

@riticmaster908 Greetings! Let’s learn together. Try to break a big question into small pieces, then think logically how to solve those small pieces one by one. Once most of the pieces are done, your performance will increase naturally. Programmers usually go through the process in a trial-and-error manner. Indeed I have not used lavalMap(). Just think in a simple way.

1 Like

hi @kswuest! pleasure to meet you.
so i have a basic lava avoider (i use 1 step squaring to get to items)
where i check if there is not lava at my next position. and i there isnt any lava, i move, else, i pass

1 Like

Counting the grids is the tricky part. Each (lava) tile is 2x2 grids. I tried to check only odd numbers but it turns out not good at all. The snail moves 4 grid/step, so it’d be better to check more grids in front.

1 Like

interesting that they made a pathfinder, I’ll go and think about it once I have time

thanks, that helps but i need helpavoiding the walls

That was the same problem for me too

I lose to many people because I run into walls

my strat is to make a function that checks if the snail is near the fall and re center the player if it is.

1 Like

@TheCodingCrusader22 that is the good way to go.

should i use coordinates?

@riticmaster908 When you don’t know how, spectate those leaders and learn from them. I learned a lot from watching their matches. Give it a try.