buttonsrtoys

Members
  • Content Count

    34
  • Joined

  • Last visited

About buttonsrtoys

  • Rank
    Advanced Member
  1. buttonsrtoys

    Best Typescript/Phaser IDE?

    Raagh, thanks for the tip. Looking forward to your phaser intellisense! I've only done a single app with phaser, so still a newbie. What kind of information will it have that a TS intellisense wouldn't? And what's the best way to get notified when your release is available?
  2. buttonsrtoys

    Best Typescript/Phaser IDE?

    Visual Studio Code looks awesome!! I'm going to take the plunge. For me, the least-fun part always is setting up the dev environment. I found a few links for setting up an environment with VSCode, Typescript, and Phaser: http://www.html5gamedevs.com/topic/27418-visual-studio-code-intellisense-for-phaserjs/ https://divillysausages.com/2015/06/09/using-phaser-with-visual-studio-code/ https://medium.com/@fenixwu/intellisense-for-phaserjs-in-visual-studio-code-82052889c5f9 If you have any other advice to help me up the learning curve I'm all ears.
  3. buttonsrtoys

    Best Typescript/Phaser IDE?

    A couple years ago a built an Asteroids clone using JS and Phaser on Cloud9 (c9.io). Was a great experience and a great way to learn JS. I'm now looking at a second game that I'd like to code with Typescript and distribute on the Android platform and possibly iOS. C9 has since been bought by Amazon and not supporting the C9 IDE as much. Regardless, it never supported breakpoints for JS, so had to debug using the Chome dev tools. My day job is coding C++ on visual studio. What's the best IDE for coding Typescript for Phaser? Ideally (for me) it would be close to Visual Studio experience (e.g., eclipse) but I'm up for something different. Mostly, I'd like to get away from the clunky C9 / Chome debugging.
  4. buttonsrtoys

    My first game (and a code review?)

    Good on you for teaching kids to code. That's much needed instruction these days and JS seems like the perfect language for kids. Regarding the sound, I wasn't sure how much managing Phaser did so asked a general question that Rich clarified for me -- http://www.html5gamedevs.com/topic/17006-need-some-clarification-on-the-soundmanager/. Based on his response, I went with a simple manager class.
  5. buttonsrtoys

    My first game (and a code review?)

    Thanks Doc!!! Your feedback's super helpful yet again. Regarding C9, I'm just getting back into programming after a 10-year absence, so certainly not the best one to ask. For what it's worth, I love the freedom of being able to pull up my IDE anywhere. Most of the time its on a Chromebook on the couch after my toddler goes down. Other times, I sneaking some game programming in at work to break up the day. Right now, it's in my basement on my PC workstation. I did look at Codenvy, but there JS support is almost non-existent. Regarding version control, I haven't explored the interface too much extent, but I believe there's support for Github, which I suspect most users are using for controlling their versions. There's also an automatic Time Machine-like backup for each file, so if you do something silly, you can slide the time bar back up to 10 days or so to retrieve something you messed up. I haven't done any non-JS with it yet except for HTML. I think it's biggest user base are website developers, but don't quote me on anything I'm telling you. It's more just my impressions from using it so far. The interface is nice and it uses ESLint or some equivalent to flag bad code before a run. One funny thing is it lets you set breakpoints but then they don't work when you run the code. Instead, they point you to the browsers environment for stepping through code, setting breakpoints, etc. So, I debug as best I can using C9's IDE and then run it inside C9, which provides a "Pop out into new window" button that creates a new Chrome window with the app running. Then, if it crashes or I want to walk through it, I use Chrome's Developer Tools. My IDE experience 10 years ago was on Visual Studio and CodeWarrior and I don't feel like I'm missing anything major that I had back then. My one nit is that C9 doesn't "see" JS functions and classes in other files, so as you saw, you need to tell each file that your using something defined in another JS file. E.g., if you have the line this.group.physicsBodyType = Phaser.Physics.ARCADEyou need the comment /* global Phaser */at the top of the file. Otherwise, your get a yellow [!] next to your line with the hover comment "warning, Phaser not defined". The warning's harmless, but if you don't put in the comment, you'll have these warnings peppered about and when there's one you really care about, you'll likely overlook it. That's why you saw all those "global" comment at the top of my file. I'm guessing they'll fix this in the future and it's not a big deal in the meantime. Also, it's free! Provided your user space is less the 500Mb or so. Also, I was up and running in 5-10 minutes. Very easy environment to find your way around. Regarding your latest feedback, I implemented your suggestions and update my code. Regarding putting sound in the DeviceMgr, I'm likely missing something, but felt like I needed a singleton to manage creating, playing, and stopping sounds. So, if a class wants to play a sound, it calls DeviceMgr.playSound('ring'). If 'ring' has not been instantiated, DeviceMgr creates an instance. Otherwise, it indexes the instance and plays it. I didn't want the classes tracking these instantiations. Or where you asking why I grouped this in with DeviceMgr instead of spinning off a separate manager? Which would be a valid comment. Or maybe a lazier/better fix would be to a better name for DeviceMgr, like IOMgr? Anyway, thanks a ton!
  6. buttonsrtoys

    My first game (and a code review?)

    I incorporated the coding suggestions, included splitting the code into separate files, moving functions to the prototype, and losing most of the private vars. The updated code is at http://richardcoutts.com/game.html. If anyone's up for reviewing the updated code, I'd be surprised and appreciative!
  7. buttonsrtoys

    My first game (and a code review?)

    Wow. Thanks Dr.! Lots of great feedback to chew on. Regarding the "this.thing = function() {}" approach, I needed this to accessed private vars, but it sounds like it's too high a price to pay for private vars? Looks like I over did it with private vars in general, which is also why I had so many get/set functions. My inclination is to bail on privates (except in special cases) and go with the prefix approach: this.publicVar; // I'm a public varthis._privateVar; // I'm a public var, too, but my underscore says 'keep out'The approach is described here -- https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Contributor_s_Guide/Private_Properties. Is this one of the more popular approaches? I'm not a slave to popular opinion. Just trying to pick up some good habits.
  8. buttonsrtoys

    My first game (and a code review?)

    Skeptron, thanks for the great feedback. My build environment (Cloud9) didn't put everything into a single html file. I'll break it down as you suggest. I was aware of GameStates when I was coding and will certainly use it on my next Phaser app. For this one I was more focused on learning JavaScript, so wanted to code the states myself with a singleton.
  9. buttonsrtoys

    My first game (and a code review?)

    @Skeptron, I don't have a repository but will try to get something up tonight. If it's not too much trouble, you can "view source" on the url to the game (it's not minified). @MichaelID, thanks for the thoughts. I added an edit to my post. Even though my app's short, I tried holding it to higher standards.
  10. buttonsrtoys

    My first game (and a code review?)

    I just finished my first JS project and my first Phaser project -- http://richardcoutts.com/game.html. It's mostly just a knockoff of the classic asteroids game with some different graphics. Had a lot of fun making it. Thanks to all who answered my newbie questions and to the Phaser developer(s) for putting together such an awesome package! This is a lot to ask, so I won't be offended if no one takes me up on it, but I'd appreciate some feedback on my code. I'm an old C++ programmer, so comfortable with OO concepts, but not sure I implemented them correctly, or whether I broke JS conventions, missed opportunities for better patterns are maybe tighter code or just plain did something silly? Edit: even though my app's short (~1000 lines), I'd like to hold it to the standards of a larger app.
  11. buttonsrtoys

    Need some clarification on the SoundManager

    Rich, so is it OK to call game.sound.play('thruster');thousands of times without calling 'remove' or 'stop' or is that chewing up memory? Most of my sound effects don't need to be stopped.
  12. I'm a bit confused about managing sounds in my game. Simply put, I'd like to add a dozen sounds and be able to play and stop them as necessary. After lifting some some code from the examples, I"m loading sounds to my game with game.load.audio('thruster', ['assets/thruster.mp3']);and playing them with game.sound.play('thruster');but I'm not seeing a 'stop' method. There is a 'stopAll' method, but I just want to stop a specific sound. I did find game.sound.removeByKey('thruster');which works, but it removes it from the manager and then 'play' adds it back? Does that mean if I use 'play' dozens of times, it will add dozens of instances to the game? If someone could clarify, or better yet, tell me which calls I should be using, I'd be indebted.
  13. I need to test whether any sprites alive in the world are within a box in the world. It doesn't have to be too accurate. E.g., just testing if the center of the sprite is within a the box is sufficient. I started coding a loop that tested the position of every sprite, but realized there was probably a collision test or some other, simple, Phaser way to do it?
  14. buttonsrtoys

    Simple P2 Question

    Sorry, I should have read your questions more closely. From what I've seen in the examples, you need extract the body's direction (i.e., rotation) and apply XY explicitly. E.g., for constant velocity: bug.body.velocity.x = Math.cos(bug.rotation) * BUG_SPEED;bug.body.velocity.y = Math.sin(bug.rotation) * BUG_SPEED;To accelerate, there's a good example here http://phaser.io/examples/v2/p2-physics/accelerate-to-object. Below's a snippet: obj1.body.force.x = Math.cos(angle) * speed; // accelerateToObject obj1.body.force.y = Math.sin(angle) * speed;
  15. buttonsrtoys

    Simple P2 Question

    Thrust is how it's done in the P2 examples. E.g., http://phaser.io/examples/v2/p2-physics/accelerate-to-object