adamyall

Members
  • Content count

    56
  • Joined

  • Last visited

  • Days Won

    1

adamyall last won the day on April 7 2014

adamyall had the most liked content!

About adamyall

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    adamholdenyall

Profile Information

  • Gender
    Not Telling
  1. TypeScript Tutorials at adam-holden.com

    New blog is up: More AMD Modularization and Finite State Machines in Phaser - Cleared up some issues with AMD modules from the last blog. Used the TypeState library to show how to easily use Finite State Machines in Phaser! Has example code and a demo! Shows how to use Finite State Machines for cleaner, extendable, and reusable code for Phaser in TypeScript. Demo
  2. Hey guys, Over the past few weeks I have been learning more about Phaser and TypeScript and I have started a blog to share what I have learned and post code that I think will help people better use Phaser with TypeScript. I was waiting to post anything about them here until I had a post with actual code in it and a GitHub repo. (Though I saw today a link to one of the posts was on the front page, thanks Rich!) I use OSX and WebStorm, but you should be able to use the code and examples in pretty much any TypeScript environment. But keep in mind these tutorials use more advanced TypeScript features (AMD modularization etc). Posts: Set Phasers to TypeScript! - Setting up a TypeScript dev environment the hard way (Brackets, Prepros, Terminal), or the easy way (WebStorm) Big Boy TypeScript: AMD Modularization and Dependency Management – Part 1 - A preface to using AMD modularization, with some "guided reading" to explain the concepts. Big Boy TypeScript: AMD Modularization and Dependency Management – Part 2 - Has example code from a Git repo. Shows how to organize your project to use AMD Modularization. Introduces you to the three ways you have to import and reference files as well as how to export classes and modules. More AMD Modularization and Finite State Machines in Phaser - Cleared up some issues with AMD modules from the last blog. Used the TypeState library to show how to easily use Finite State Machines in Phaser! Has example code and a demo! More to come! If you haven't ever used TypeScript, I would recommend doing some reading at the TypeScript website before reading these blogs. Afterwards, do some Phaser stuff with TypeScript.
  3. mummy exmple

    You can flip a sprite horizontally by setting it's x scale to be negative. For instance, change this: mummy.scale.setTo(2, 2); To: mummy.scale.setTo(-2,2);
  4. Bunnymark perf comparisons...

    Impressive performance!
  5. How to subclass Sprite?

    ".call" is used in JavaScript to call a function with a different scope than the scope in which it is called. In other words, Phaser.Sprite.call(this,game,x,y,v[0]) is equivalent to Phaser.Sprite(game,x,y,v[0]).
  6. Pass parameter to button callback

    Similar question:http://www.html5gamedevs.com/topic/5351-call-a-function-with-arguments-when-oninputdown/
  7. Typescript and "this" scope

    Glad I was able to steer you in the right direction! I'm really liking typescript with Phaser, it forces you to write cleaner code. I'm glad that Phaser is so versatile, but I'd like to see more people using TypeScript, because seeing the completion and inheritances will clarify the structure of Phaser immensely. So kudos for going that route. Btw, my next few blog posts at adam-holden.com are going to be related to TypeScript with Phaser. /self promotion
  8. Typescript and "this" scope

    It's hard to tell without seeing your whole file, but if that jump function is in the class definition, try removing the "function" keyword. What I think is happening is that you are making that jump function a member variable of the type function (In JavaScript Syntax, not TypeScript syntax btw). Therefore when you call the function, "this" is referring to the function itself, not to the class that you have added it to.
  9. Pinch and mousewheel

    http://jsfiddle.net/adamholdenyall/G68ee/7/ Made a fiddle to figure this out myself. Probably the best way to handle gestures is to just include Hammer.js as gesture support in Phaser itself is limited as far as I can tell. The example shows both pinch to zoom and scroll to zoom. Works for me on Chrome for Android and Firefox.
  10. Phaser 2.0.2 jsFiddle (Sticky?)

    You're welcome, I hope more people see it.
  11. Play a sprite animation starting in the middle?

    Pull request added. (Here's a link for anyone interested) https://github.com/photonstorm/phaser/pull/706
  12. How to safely destroy() a sprite with a physics body?

    Have you tried setting the outOfBoundsKill flag on the sprite to true? I think that will do it for you.
  13. Play a sprite animation starting in the middle?

    I figured out how to do it, but you have to touch a lot of private members. I'm going to take a crack at implementing it in 2.0.3 dev, but not going to make it a parameter to play.
  14. Play a sprite animation starting in the middle?

    Something like that is definitely a fallback
  15. I have a jump animation and a midair movement animation. The jump animation is 5 frames long, and I want it to play all the way through when the player jumps from a grounded state. However if the user jumps starting from the ground, then starts to move left or right, it plays the midair movement animation. Now, when the user stops moving, I want to transition back to jumping, but starting at frame 4 or 5 of the jumping animation. sprite.play(name);sprite.animations.frameName = frameId;I've also tried using animations.frame = number, but no luck with that either. I just need to know if there's a play, but skip to frame method that I'm not seeing.