-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|699|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


Tuesday, 10 May 2022, 06:25
Jayenkai
I remembered today, that one of the reasons I wrote JSE is because I couldn't figure out how to run this, and realised we needed a language that could be used to things like this...


So, um, a year and a bit later, here's my reply!

> Reveal 🔎

\o/yeay\o/


|update| Updated with optimised drawing function! |update|
Tuesday, 10 May 2022, 12:02
Pakz
I still need to dive into the language and learn how to do things. I have been concentrating on music for so long now that I have done barely any programming in the last couple of years.

This tool is an attractive option I had a idea of a demo yesterday where I would use grenades that exploded into other grenades and those would explode into every part of a maze. That to be used for pathing...