Coder Social home page Coder Social logo

vonhoff / animation2tilemap Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 2.94 MB

A tool that converts animations to tilemaps and tilesets.

License: MIT License

C# 100.00%
tiled-map-editor tilemap-animations tileset-generator tilemap tilemap-editor tileset-editor tileset tilemaps tilesets generator

animation2tilemap's Introduction

Animation2Tilemap

workflow version version

Animation2Tilemap is a tool to easily convert images or animated images to tilemaps and tilesets.

The files generated by Animation2Tilemap can be imported into Tiled for further editing and customization. This tool provides both a command-line interface and an easy-to-use GUI option.

Features

Animation2Tilemap offers the following features:

  • Support for various input formats, including Bmp, Gif, Jpeg, Pbm, Png, Tiff, Tga, and WebP.
  • Process animations to tilemaps from either folders or images that contain multiple frames.
  • Generate an animated tileset from an image or a folder containing extracted animation frames.
  • Customize the tile size, transparent color, and frame duration of your animations.
  • Generate tilesets and tilemaps in Tiled compatible formats, such as base64, zlib, gzip, and csv.

Example Use Case

Using this tool, you can convert the following animation into an animated tileset and tilemap. It results in a set of PNG, TSX, and TMX files that collectively represent the original image.

Input Image Resulting Output
Input image Output image

Image source: https://x.com/jmw327/status/1405872936783802384

Installation

Before installing Animation2Tilemap, make sure you have the .NET 8 runtime installed on your system. You can get it from https://dotnet.microsoft.com/en-us/download/dotnet/8.0

To install Animation2Tilemap, you need to follow these steps:

  • Go to the releases page and download the latest version.
  • Extract the zip file to a folder of your choice. You can use any file manager or unzip utility to do this.

Command-line Usage

Open a terminal and go to the folder where you installed Animation2Tilemap. To convert an animation into a tileset and tilemap, run this command: animation2tilemap.console -i <input> -o <output> where <input> and <output> are the paths to the animation and output folders.

To see the help page within the command-line application, you can run the console application with the --help option. This will show you the available options and parameters that you can use.

You can also specify other options to customize the output, such as:

Option Description Default
-d --duration <duration> The duration of each animation frame in milliseconds. 125
-h --height <height> The height of each tile in pixels. 8
-w --width <width> The width of each tile in pixels. 8
-m --margin <margin> The margin around the tiles. 0
-s --spacing <spacing> The spacing between the tiles. 0
-t --transparent <transparent> The transparent color in RGBA format. 00000000
-f --format <base64|zlib|gzip|csv> The format of the tile layer data. zlib
-v --verbose Enables verbose logging for debugging purposes. false
-? --help Shows help and usage information.

Screenshot

Program screenshot

Motivation

I was inspired by classic isometric games like Populous. My goal was to replicate that style in my own projects by using Tilengine as a rendering engine. However, I encountered a challenge due to its lack of native support for diamond isometric tiles.

Tilengine does not support diamond tiles because standard 2D chipsets do not support them either. Classic isometric games, such as Populous, used standard square tiles that were diagonally split. This combination of corners from different diamond tiles gave the illusion of isometric tiles.

To work around this, I divided pre-rendered animated images into square tiles. This approach allowed me to integrate animated elements into an orthographic tileset. However, the process was cumbersome. It involved manual extraction, slicing, and filtering for duplicates, as well as organizing the tiles. I created this tool to automate that process.

Acknowledgments

If you find Animation2Tilemap useful in your projects, consider leaving a star! โญ

Contribution

If you want to contribute to Animation2Tilemap, you are welcome to submit pull requests or report issues on GitHub.

animation2tilemap's People

Contributors

dependabot[bot] avatar vonhoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.