Skip to content

Commit

Permalink
Merge pull request #1 from dev-masih/readme-masih-patch-1
Browse files Browse the repository at this point in the history
fixed some typos in readme
  • Loading branch information
dev-masih authored Oct 13, 2019
2 parents 0ece133 + f4908fb commit 44b5dd6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="example/banner.jpg" alt="routing gif" style="max-width:100%;" />

This module contains functions to create a world map as a shape of a graph and the ability to manipulate it at any time, easily see debug draw of this graph and move go's inside of this graph with utilizing auto pathfilder.
This module contains functions to create a world map as a shape of a graph and the ability to manipulate it at any time, easily see debug drawing of this graph and move go's inside of this graph with utilizing auto pathfinder.

You can define a graph with several nodes and routes between them and the extension takes care of finding and moving your go inside this graph with just one call inside player update function.
the gif bellow shows you this exactly when the destination for all red circles is node number 6.
Expand All @@ -17,7 +17,7 @@ defGraph is adaptable to map change so even if you add or remove routes in the m
This is a community project you are welcome to contribute to it, sending PR, suggest a feature or report a bug.

## Installation
You can use DefGraph in your own project by adding this project as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:
You can use DefGraph in your project by adding this project as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:

https://github.com/dev-masih/defgraph/archive/master.zip

Expand All @@ -29,32 +29,32 @@ local defgraph = require("defgraph.defgraph")
Then you can use the DefGraph functions using this module.

## Functions
These are the list of available functions to use, for better undrestanding of how this module works, please take a look at project example.
These are the list of available functions to use, for better understanding of how this module works, please take a look at project example.

### map_add_node(position)
Adding a node at the given position (position.z will get ignored)
**arguments:** position as vector3
**return:** Newly added node id as number

### map_add_route(source_id, destination_id)
Adding a two way route between nodes with id of source_id and destination_id
Adding a two-way route between nodes with ids of source_id and destination_id
**arguments:** source_id as number, destination_id as number

### map_remove_route(source_id, destination_id)
Removing an existing route between nodes with id of source_id and destination_id
Removing an existing route between nodes with ids of source_id and destination_id
**arguments:** source_id as number, destination_id as number

### move_initialize(source_position, threshold, destination_id)
initialize moves from source_position to node with id of destination_id inside map with specified threshold in position calculations
initialize moves from source_position to a node with an id of destination_id inside the map with the specified threshold in position calculations
**arguments:** source_position as vector3, threshold as number, destination_id as number
**return:** special movement data as table
> **Note:** The returned special table consisd of combined data to use later in `move_player` and `debug_draw_player_move` functions.
> **Note:** The returned special table consists of combined data to use later in `move_player` and `debug_draw_player_move` functions.
### move_player(current_position, speed, move_data)
calculate movements from current_position of game object inside given map considering given speed and dt useing last calculated movement data
calculate movements from current_position of the game object inside a given map considering given speed and using last calculated movement data
**arguments:** current_position as vector3, speed as number, move_data as table
**return:** new position for movement as vector3, new movement data as table, is reached to destination as boolean
> **Note:** The returned new movement data should overwrite old movement data. normally this function is placed inside go update function and you can set go position to returned position. also you should multiply `dt` with speed yourself before passing it to function.
> **Note:** The returned new movement data should overwrite old movement data. normally this function is placed inside go update function and you can set go position to returned position. also, you should multiply `dt` with speed yourself before passing it to function.

### debug_set_properties(node_color, route_color, draw_scale)
Expand Down

0 comments on commit 44b5dd6

Please sign in to comment.