Posted on 04/20/2015 at 02:47 PM
| Filed Under Blogs
I've written the game in Javascript, with the help of HTML 5 and CSS 3 for the UI. It's an... interesting... language. Having done plenty of web development, I have a bunch of experience with the language, but never really "used" it, so to speak. Now that I've gotten knee deep in it, I've really got a handle on how to do javascript right.
It's kind of a crazy language, because there are just closures absolutely freakin everywhere. Not to mention, it's all event-driven, so order of operations can be a serious challenge. Something as simple as getting a loading screen to pop-up took some mental acrobatics.
After years and years of programming primarily Java, it's hard NOT to think in object-oriented. Once the switch flipped to that mindset, it kind of got stuck there. Even with my game, I'd say that I fell into the hole early on of trying to make it very object-oriented instead of playing to the functional strengths of Javascript. It took a near full-rewrite to right my wrongs, and even then, I still have stuff that's a bit sloppy for my tastes.
I guess the thing to remember when doing OO is SOLID. It's a good set of guiding principles on how to do Object Orientation right. Hopefully your teachers have pointed you towards that before throwing you into the fire!
For what it's worth, I was able to get the OO stuff straight by building a little list management system, which ultimately became the Game Collection system you see here on PixlBit. Modeling and implementing that system really brought clarity to the concepts for me, hopefully your Battleship game does the same for you!
If you do have any pointed questions, shoot me a PM or an email, I'm glad to help!