+1 vote

So, as the title says I'm trying to create a tileset to use on a tileMap automatically, since the standard method would simply consume too much of my time everytime I needed to provide new tiles (be it the map or enemies).

I'm using Godot for the first day on version 2.1.1 64 bits on Linux

I've tried hacking up a script which ended being similar to this (which I'm now trying to use):

tool extends Node2D

export(bool) var reset = false setget onReset

var root =  get_tree().get_edited_scene_root()
var floor_texture = preload("res://assets/tileset/floor1.png")

func _ready():
    # Called every time the node is added to the scene.
    # Initialization here

func onReset(isTriggered):
    if (isTriggered):
        reset = false
        var w = floor_texture.get_width() / tileSize
        var h = floor_texture.get_height() / tileSize

        for x in range(w):
            for y in range(h):
                var tile = Sprite.new()
                tile.set_region_rect(Rect2(x*tileSize, y*tileSize, tileSize, tileSize))
                tile.set_pos(Vector2(x*tileSize+tileSize/2, y*tileSize+tileSize/2))

To the root node of the tileset scene, but can not figure out how it's not working...

Searching for other methods I stumbled into addons on this list, which pointed me to this solution already done by a senior on the community. I placed the plugin in addons folder in my project structure (as needed by version 2.1.1), activated it, but the option shown in the github image are not appearing in the 2d scene. I'm lost.

Am I missing something? I've read the getting started tutorial about three times now and the GDscript very carefully but I'm somehow still missing something.

in Engine by (23 points)

That plugin is old and will need some fixes to fit on 2.1.x.

Try using this one from the asset lib, has multiple ways to create tilesets (from files, from a single tileset, et cetera), it also adds collision polygons and occluders when making or by selecting the created sprites.


You can search and add it to your project from the assetlib inside Godot or download and add manually.

1 Answer

0 votes

That was it, thank you so much :)))

by (23 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.