-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|132|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Generators


 
Pakz
Created : 16 February 2021
Edited : 16 February 2021
Language : GDScript 3.2

Random Walker Mazelike maps(Godot script)

Some Godot script for creating maps.



I thought I would show of some Godot script. I had been learning this for a while now and think I am getting a bit used to it. I was watching a coding train episode where a random walker was shown and I think I had a idea for something like that for maps.

Godot has a pretty confusing editor. You need to first select a scene(2d node in this case) and then create a script on that scene node. The code below is the script attached to the main 2d node. That is the easiest way to get programming and be able to do 2d stuff without using all the editor its features.

The code below is commented. It is not thought out that well but it seems to work.

The basics are that you have a random walker and a list of its position history. The walker has certain rules of not being able to step into other paths. When he gets stuck the last position on the list gets popped and the previous position is checked if a valid new move can be taken from there. This should create a maze like map.

Latest Update

Here you can use godot directly as a html app. : https://godotengine.org/editor

 

Comments