ippa / jaws

Jaws - HTML5 canvas javascript 2D Game Framework
https://jawsjs.ippa.se
GNU Lesser General Public License v3.0
363 stars 75 forks source link

Implemented A* pathfinding on TileMap, example included #61

Closed MalphasWats closed 11 years ago

MalphasWats commented 11 years ago

I've implemented a basic pathfinding algorithm to the TileMap class, example14.html shows how to use it.

I've added the code to both jaws.js and src/tile_map.js but I HAVE NOT updated the minified version as I don't know what minifier is used, so I didn't want to mess in there.

it's fairly quick, much quicker than redrawing a large sprite list!

I did my best to follow the style guidelines, happy to make any changes necessary. Hopefully it's useful.

ippa commented 11 years ago

Hi, back from skitrip. Nice work. Adding the code to tile_map.js is correct, jaws.js (and jaws-min.js) is compiled from the sourcefiles. I like that you made an example too.. would it be possible with some simple testcases to make it even clearer exactly what the new pathfinding-methods does?

MalphasWats commented 11 years ago

Yeah, I realised that when I looked in the build script, not being a rubyist, I'd been ignoring it!

I'll have a go at some tests, although I'm criminally inexperienced with writing them!