Jump to content

Phaser 0.9 Update


rich
 Share

Recommended Posts

Large refactoring. Everything now lives inside the Phaser module, so all code and all tests have been updated to reflect this. Makes coding a tiny bit more verbose but stops the framework from globbing up the global namespace. Also should make code-insight work in WebStorm and similar editors.


Added the new GeomSprite object. This is a sprite that uses a geometry class for display (Circle, Rectangle, Point, Line). It's extremely flexible!


Added Geometry intersection results objects.


Added new Collision class and moved some functions there. Contains all the Game Object and Geometry Intersection methods.


Can now create a sprite animation based on frame names rather than indexes. Useful when you've an animation inside a texture atlas.

 

Added test to show.

 

Added addKeyCapture(), removeKeyCapture() and clearCaptures() to Input.Keyboard. Calls event.preventDefault() on any keycode set to capture, allowing you to avoid page scrolling when using the cursor keys in a game for example.

 

Added new Motion class which contains lots of handy functions like 'moveTowardsObject', 'velocityFromAngle' and more.

 

Tween Manager added. You can now create tweens via Game.createTween (or for more control game.tweens). All the usual suspects are here: Bounce, Elastic, Quintic, etc and it's hooked into the core game clock, so if your game pauses and resumes your tweens adjust accordingly.

 

Tidied up every single class now. Common header formats, started work on docs and lots of house keeping.

 

Link to comment
Share on other sites

Mate ... you are updating faster than Adobe is updating Acrobat Reader ... But in contrast - your updates are constantly adding much more cool features ;-)

 

Changelog just sounds outstanding. Thanks a lot.

 

Damn ... I need more time!

Link to comment
Share on other sites

I can't believe how quickly you're updating this! I'm currently learning my way through ImpactJS, but knowing how much time and effort you've put in to both this and kiwi.js I'm gonna have to check this out very soon, I suspect your framework(s) will be ultimately more flexible to work with than Impact.  :)

Link to comment
Share on other sites

Recent updates are way more cool than no updates. :)

 

I have a question about the development structure,  since I've worked on two libraries and I made all inclusion trough the import module pastern and using require.js

and then when i make a test game, or add features, when something bugs, it points to the concrete .ts class.

 

With Phaser in the moment, i have to compile to .js and then used it.

 

Then if i make core change ... just for testing purposes like adding config for which keys are binded by default and which not...

or anything i have to compile, and test again.

 

So my question is do you have something in mind for not using the require.js AMD style ?

Link to comment
Share on other sites

There's no reason why you couldn't use AMD for your game structure and just import the sourcemap for the Phaser side of it, but I don't have any plans to convert to using require.js, sorry. It's too much overhead/set-up involved for those new to it, and requires a build process to create the final game. Basically it removes the "drop in and play" nature that I struggled really hard to keep - the same way that three.js does it for example. That doesn't mean we can't branch to a module based build later though, because I know some devs like it.

Link to comment
Share on other sites

Thanks deis. To be honest once we have tile map collision I'm pretty sure we will be close to matching impact feature for feature, in terms of under the hood anyway. They of course still have the level editor and packaging scripts, but personally I prefer using Tiled or DAME anyway :)

Link to comment
Share on other sites

No solid plans, but I did roll around the idea of a HTML5 Tilemap editor with Phaser. I think it would be a nice addition and definitly awesome if we can build HTML5 based tools around it.

 

Ideas:

Tilemap Editor

Particle Emitter Designer

Timeline Tweening Editor

etc.

Link to comment
Share on other sites

There are lots of tile map editors out there already, but something really really lacking (that I have never seen done well before) is a path editor. The ability to lay down a series of points, to define the speed and ease used between them, and then run some sprites down them - that is something I've wanted for many years :)

Link to comment
Share on other sites

I created a VERY basic path editor as a helper script for a app I worked on some time ago: http://wearekiss.com/lab/pathetic/

 

To start, place your cursor somewhere and hit N.

To extend the path, move your mouse somewhere and hit SPACE.

You can grab the control points and bend your path.

 

Should be easy extendable and is already on github.

Link to comment
Share on other sites

I was trying to run this simple code : 

 

 

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src = "Phaser/phaser.js"></script>
    <script src = "Main.js"></script>
</head>
<body>
    <div id="game"></div>
 
    <script type="text/javascript">
 
    var myGame = new Game(this, 'game', 840, 400);
    myGame.switchState(Main);
 
    </script>
 
</body>
</html>
 
And my .js file : 

Main = function (game)
{
    this.game = game;
}
 
Main.prototype =
{
    init : function()
    {
        this.game.camera.backgroundColor = 'rgb(85,85,85)';
    },
 
    create : function()
    {
 
    },
 
    update : function()
    {
 
    },
 
    render : function()
    {
 
    }
}
 
 

Before de update to new 0.9 version, the code was running normal, but now he don't work, the browser console says "Uncaught ReferenceError : Game is not defined" and my code cannot more found the Game.ts. Can anyone help me with this problem?

 

(Sorry for my bad english)

Link to comment
Share on other sites

Very thanks Rich, its working now!


I was looking to files in 'Tests' folder, and this problem happens. One suggestion that i make is update (if possible) the codes in Tests folder to new version of Phaser, but only if possible to you. You are doing a REALLY GREAT JOB with Phaser, and i can say only thanks for share this with all us.

Link to comment
Share on other sites

I did update all of the Tests! Now you've got me worried they didn't get pushed to git. Checking now ... :)

 

Edit: Phew, yes ok all the new tests are up there too with the correct code in. It also changed some other things, like before where you may have used Sprite you need to use Phaser.Sprite.

Link to comment
Share on other sites

Just thinking ... 

 

Would a plugin system (in a long term) make sense ?

 

I guess planning a solid plugin system might take some time and I do not know the software design of Phaser ? However I guess there would be loads of devs in the community happily releasing plugins to extend the lib ?

Link to comment
Share on other sites

Already planned :) There is a plugins folder on my local build that I will open up soon. It will help stop the framework get too bloated and allow me to release fun but non-essential stuff like special fx plugins.

 

Yeah!

Link to comment
Share on other sites

Hi Rich, i'm here again to boring you XD.
 
I back on my test in the Phaser, and when i try put one simple text to make one "Hello World", the text don't apear. Here is the code : 

 

Main = function (game){    this.game = game;}Main.prototype ={    init : function()    {        this.game.camera.backgroundColor = 'rgb(50,50,50)';    },    create : function()    {    },    update : function()    {    },    render : function()    {        this.game.stage.context.fillStyle = 'rgb(255,255,255)';        this.game.stage.context.font = 'bold 48px Arial';        this.game.stage.context.textAlign = 'center';        this.game.stage.context.fillText("Teste", 10, 20);    }}

 

Can you help me please?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...