Coder Social home page Coder Social logo

godot-tilemap's Introduction

In action

https://github.com/AlexHolly/HelloGodot

#Tut

1.Copy this script to your Project folder

2.Add this script as autoload and leave the name as tilemap Scene -> Projects Settings -> Autoload

3.Create a TileMap Node and add a new script to this Node.

#Modes

Tileset - Use your Tileset Scene as objects source. -> Adds the Root Node children as objects

Scene - Use your Scene as objects source. -> Adds the Root Node as object, add multible Scenes with a dictionary ["name"] = PATH

#Example - Scene Mode

extends TileMap

#Choose parent Node
onready var map = get_parent().get_node("Map")

#Define objects
var objects = {
	"Brick":"res://scenes/brick.scn",
	"Wall":"res://scenes/wall.scn"

}

#Run
func _ready():
	tilemap.build_tilemap(self, objects, map)

#Example - Tileset Mode

extends TileMap

#Choose parent Node
onready var map = get_parent().get_node("Map")

#Run
func _ready():
	var objects = tilemap.get_objects("res://tilesetscene.tscn")
	tilemap.build_tilemap(self, objects, map)

#Other -You can also use the TileMap Node as map(parent Node for created objects) tilemap.build_tilemap(self, objects)

-Use multible Tilemap Nodes each is one layer to get z sort.

#ISSUES

  • The Tileset mode is executing _ready twice. It also breaks usage of get_name() (if duplucate Scenes are used) because each instance will get an incremented ID. -> workaround use the id ad name -> export(String,"wall","brick","brick2") var id
  • Sometimes create TileSet merge or not merge is not working.
  • Each Sprite needs his own name otherwise the tileset will show wrong stuff

#TODO

  • y sort
  • rotation

#Supports

  • isometric/square mode

godot-tilemap's People

Contributors

alexholly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.