Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

PLZ Give me the solutuion for the level called Zone of Danger


Please please pleasePLZ Give me the solutuion for the level called Zone of Danger


Before I post any solutions, maybe I can guide you through it.

Do you think you have the distanceTo function right? Do you know how to calculate a distance? might help here.

About getNearestEnemy, did you check out the for loop snippet? It is a good idea make an array of enenmies. Then, it’s a good idea to use a for loop. In each iteration of the for loop you consider one enemy, so that the iterator runs from 0 to enemies.length - 1. At every iteration, you check to see if the distance to the enemy currently being considered is smaller than that of all the enemies considered so far. If the distance is smaller, the enemy being considered should be the new target.

Does that help?


Not really. Can u just give me solution


Still Dosen’t work. Help me. My multiplayer link is:

I beg u 2 help me.


I have edited your code. Now it works. You put both the code blocks above (along with their descriptions) into the function getNearestEnemy(). You were supposed to copy paste the block under getNearestEnemy into getNearestEnemy and the block under distanceTo into distanceTo.

I do encourage you to write your own solution. Maybe you can come up with your own version of distanceTo?


Can you please help me with Gridmancer Then???


I have not solved gridmaster myself. But wouldn’t it be fun for you to play around with the code I gave you? Or maybe try an easier level?


@jacobakkerboom we don’t post correct code


@jtonuri do not ask for correct code.


@Neel_Sharma Please report such posts in the future. Click in the “Flag” icon below a post and it will open an interface to report the post to the staff.


I did flag the posts. Then I wrote these posts.


Oh I see, your flag was handled by another moderator.
I’ve deleted the post as it was nothing but an attempt to provide a solution that is not useful to future readers at all.


Yeah ok thanks Ultcombo