Threllous/DragonWarriorJS — pull request #1 by bsclifton (2014-12-10 06:46:05+00:00)
Title: WOW. Lots of changes!

Hey there :) Hopefully this is coming as a surprise! You did a great job with this project and I made some contributions in my free time

Noteable items:
1) I put just about everything in a new file, config.js, with the hopes that the rest of the code can be an "engine" (for example if you wanted to make DW2). Player level data is there, I moved map coordinates there from map_functions.js. Tried to get rid of any hardcoding.
2) Pulled all text into text.js. This should make translating the game to other languages a piece of cake.
3) Better performance- the images were being loaded every frame, which slowed things down quite a bit
4) Placed all NPCs and wired up all text. There's a lot to finish (conditionals, menu based text, etc). But its a pretty good start. Updated code so that NPCs position properly and cant be walked through.
5) Stubbed out a basic script module. Right now, only used for talking. The object is passed to the talk() method, so you don't need to access it globally.
6) Started to wrap each module in a namespace. For example, Game, Game.script, Game.combat, etc. Not important, but usually it's a best practice to limit your impact to the global scope.
7) Wired everything up with grunt.js. This is something that is totally optional, but it'll combine, minify, and copy all the files to a folder "dist". I believe all the JavaScript files when combined/minified work out to be ~170k, which is pretty decent :) This would be the binaries you upload to a site, so that the download is extremely quick for folks
8) Door and talk actions work. It's rough, but give them a try
9) Put in the enemies "specials" (spell cast, or breathing fire). It'll process but I didn't implement the spell casting.
10) Put a ton of "TODO:" comments in the code with notes and suggestions

That's most of what I was able to sort out. It was a LOT of fun to work on this. I'm getting ready to take some time off, so I wanted to share with you. If you enjoy this, consider it an early Christmas gift :) I LOVE all the Dragon Warrior games and you did a great job. If you wanted to jump back in, that's definitely cool. I may return to the code in a week or two, who knows.

Let me know what you think about all of this. Hoping you accept the pull request!
Brian