-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random points *not walkable* - question. #180
Comments
The node already has a flag called "walkable" so after you instantiated the grid you could get some random cells from there and set walkable to false:
|
I don't know if I implemented the code well. I've rewritten the code and added it to the switch, in which case it works... but the elements are still not blocked? Could you help me because I don't know if I'm doing it right? MfG case 'opened':
|
You are doing this at the wrong position. You create a new grid while you already have a grid in the controller.js, I suggest you do that there. Also you use a for loop which might not work for you because Math.random might pick the same tile again (not very lightly but might happen). For example this would create 30 random walls whenever you press the "Usun Wszystko" button you can overwrite your buildNewGrid-function with this (after you undo your changes to the switch):
|
how to generate random points in this grid that cannot be passed through? Currently, if we draw them with a mouse, they are blocked. In view.js, I use a switch and a case 'opened' by throwing in a for loop that generates these elements (blocked grey points) but they are ignored, the user goes through them even though they are on the map. Could somebody help me?
The text was updated successfully, but these errors were encountered: