Coder Social home page Coder Social logo

boyquotes / ps_tileastar2d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from progsource/ps_tileastar2d

0.0 0.0 0.0 5 KB

This Godot plugin provides pathfinding nodes for the A* algorithm on 2D TileMaps.

License: MIT License

GDScript 100.00%

ps_tileastar2d's Introduction

ps_TileAStar2D

This Godot plugin provides pathfinding nodes for the A* algorithm on 2D TileMaps.

Tested Godot version: 3.2.3

Use it as you see fit.

Info: This repository is in maintenance mode. I do not work actively on it, but if you create issues or Pull Requests, I will take a look. Time-wise that might vary though.

HowTo

  • Add this folder to your Godot project {project folder}/addons/ps_tileastar2d
  • Activate the plugin in your project settings
  • Add ps_TileAStar2D_TileMapConnector.tscn to your scene
  • Configure the tile size via "Con Cell Size" - possible sizes are "16x16", "32x32" and "48x48"
  • Draw with the tile with the related size on the TileMap wherever your objects shall walk on
  • If you want to see the created AStar path, make the debug node shortly invisible and then visible again
  • If you want to see the created AStar path inside of your game, turn on the debug flag
  • After that you should be able to use the astar object from ps_TileAStar2D_TileMapConnector to create your paths

Example usage

var astar = null # get it from ps_TileAStar2D_TileMapConnector
var actor_position = Vector2() # get this from the object that you want to move around
var target_position = Vector2() # get this from the destination where you want your object to move to

var closest_point_to_actor = astar.get_closest_point(actor_position)
var closest_point_to_target = astar.get_closest_point(target_position)
var path = astar.get_point_path(closest_point_to_actor, closest_point_to_target)

Why?

During the Global GameJam 2021 we needed pathfinding in our pet project. To not have to come up with it again in any upcoming gamejams, I created this plugin.

The one TileMap to draw the possible path on has the reason, that you might have multiple TileMaps for your floor and objects. This is an easy and short way to make AStar work for you.

License

MIT - for more info see LICENSE or check the GDScript files.

ps_tileastar2d's People

Contributors

progsource 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.