Jump to content

Tom Atom

Members
  • Content Count

    594
  • Joined

  • Last visited

  • Days Won

    6

Reputation Activity

  1. Like
    Tom Atom reacted to samme in Phaser Scene Graph plugin   
    There's now a "live" view of one level of the display tree with `game.debug.renderGraph()`. It can help you keep track of object pools (Weapons, Emitters, enemies) and also identify unusual situations (empty/dead groups, dead-but-existing sprites). Try the new demo.

  2. Like
    Tom Atom got a reaction from espace in array of button and action on clic problem   
    Hi, reason is, that your counter (i) stops at 5. And when any of buttons is clicked, it takes actual value of i (=5). You need to save actual value of counter somewhere, while iterating. Try this:
    for (var i=0;i < 5;i++){ this.buttons[i]=game.add.button(this.posx,this.posy+i*50,im,(but) => this.action(but.id),this) this.buttons[i].id = i; this.g.add(this.buttons[i]) }  When button is clicked, it is passed to callback handler. In it you can read dynamicly added property "id", which saved actual value of iterator i.
  3. Like
    Tom Atom reacted to samme in Advanced Timing Plugin: FPS graph, meter, text   
    Source & Docs / Demo / NPM
    Free bunny screensaver included.


  4. Like
    Tom Atom reacted to drhayes in TypeScript vs JavaScript?   
  5. Like
    Tom Atom got a reaction from Balamurugan in TypeScript vs JavaScript?   
    Hi, it is always good to know pure JS, but with TS you get type checking, which prevents errors and increases productivity. TS is not separate language, but it is superset of JS. If you have Java (or C#) experience, then OOP is similar in it (as well as in ES6, but there it is without type checking). If you are on Windows, there is also very luxury IDE - Microsoft Visual Studio Community 2015, which is free for individual developers. It has great intellisense support.
    In my book I made small comparsion of TS / ES6 / JS:
     Just for example, consider this simple TypeScript class:


    class MyClass { private _position: Phaser.Point = new Phaser.Point(); public constructor(position: Phaser.Point) { this._position.copyFrom(position); } public moveBy(x: number, y: number): void { this._position.add(x, y); } }  It is compiled into this JavaScript code:


    var MyClass = (function () { function MyClass(position) { this._position = new Phaser.Point(); this._position.copyFrom(position); } MyClass.prototype.moveBy = function (x, y) { this._position.add(x, y); }; return MyClass; } ());  Or into this ES6 code:


     
    class MyClass { constructor(position) { this._position = new Phaser.Point(); this._position.copyFrom(position); } moveBy(x, y) { this._position.add(x, y); } }  
  6. Like
    Tom Atom got a reaction from drhayes in TypeScript vs JavaScript?   
    @mattstyles - I think this is not right... context in above example is not game, but that anonymous state object that is passed into game constructor. Change your fiddle example to this:
    window.onload = function () { var game = new Phaser.Game(800, 600, Phaser.AUTO, 'content', {myVal:"I am state!", preload: preload, create: create }); function preload() {} function create() { console.log('-->', this.myVal, 'not what you would expect!') game.time.events.add(1000, createEnemy, this); } function createEnemy() { console.log("ok, ok, ... creating..."); console.log(this.myVal); // create and add enemy sprite here } };  In your example, the console output was not Game, but State. Here it is more obvious: through "this" you have access to myVal added into anonymous state.
     To test further, add 2 new lines just below game:
    window.onload = function () { var game = new Phaser.Game(800, 600, Phaser.AUTO, 'content', {myVal:"I am state!", preload: preload, create: create }); createEnemy(); createEnemy.call(game); : :  For both this calls you get output;
      ok, ok, ... creating...
      undefined
     undefined is for printing this.myVal. You must be inside this object: {myVal:"I am state!", preload: preload, create: create } to print its value.
     
  7. Like
    Tom Atom got a reaction from BdR in Weird graphic glitch using WEBGL on iPad   
    Hi, this is quite a common problem. In your atlas, you have one pixel free space between images. But it is not enough for tiling sprites. If you use TexturePacker, use Extrude (https://www.codeandweb.com/texturepacker/documentation) to repeat pixels at image borders. I have my own sprite packing tool, so have no experience with TP, but I use only extrude - no padding is then needed.
  8. Like
    Tom Atom got a reaction from btzr in [Phaser] Gravity Ninja   
    Gravity Ninja is another one-button game made for Gamee platform.You are changing gravity direction with button presses, so your ninja character runs on floor or ceiling. Run as far as you can and do not hit walls.
        
    You can play it here: https://www.gameeapp.com/game/G1oy49taR
     
  9. Like
    Tom Atom got a reaction from threedollarbill in Loaded binary file never gets added to the cache? (unable to access it)   
    Hi, your onZipBinaryLoaded must return value - this is from one of my games:
    public onBinaryLoaded(key: string, data: ArrayBuffer) { return data; }  
  10. Like
    Tom Atom got a reaction from samme in Weird graphic glitch using WEBGL on iPad   
    Hi, this is quite a common problem. In your atlas, you have one pixel free space between images. But it is not enough for tiling sprites. If you use TexturePacker, use Extrude (https://www.codeandweb.com/texturepacker/documentation) to repeat pixels at image borders. I have my own sprite packing tool, so have no experience with TP, but I use only extrude - no padding is then needed.
  11. Like
    Tom Atom got a reaction from plicatibu in How to retrieve image width that is in an atlas using cache object   
    Or you can shorten it to:
    game.cache.getFrameByName("atlas", "Sprite").width;  
  12. Like
    Tom Atom got a reaction from Mike018 in Splitting sprites up into multiple sprites?   
    If I were you I would save the space. I would make class "Cloud" extending Phaser.Group and then applied approach Rich mentioned. With single group you can move, scale, rotate whole cloud with all its parts.
    Another way is to use some animation program and create animation of cloud from individual parts. Then, in your code, you can play it. Advantage is that you can create complex animations even from small amount of parts. I am using Spriter for this and playing it with Spriter Player for Phaser (https://github.com/SBCGames/Spriter-Player-for-Phaser)
  13. Like
    Tom Atom got a reaction from sbonavida in Phaser 2.4.2 - TypeScript - VS2015 - Issue with Intellisense comments   
    Hi, try to create "lib" directory and put .d.ts files into it (delete it from all other locations).
    This is my project structure in VS 2015. Not all directories are in it:

    This is complete project sturcture on disk:

    There is rest of directories: assets, js. You can have it in VS or not - depends on you. I do not have it in VS as I do not access assets through it. Bin and obj are dirs created by VS during compilation.
  14. Like
    Tom Atom got a reaction from samme in Tween not working in CANVAS rendering mode on Android device   
    Hi, your tween is pretty fast - 100 ms. If there are some performance problems in canvas mode (low frames) on target device, it may look like no tween animation is running. For test, try to set tween duration to 3 seconds (3000 ms).
  15. Like
    Tom Atom got a reaction from plicatibu in Phaser & Intel XDK   
    Hi, in Cordova this works:
    document.addEventListener("backbutton", function (e) { e.preventDefault(); if (this.exit) { navigator["app"].exitApp(); } else { console.log("not exiting..."); } }, false);  If I am not wrong, intel XDK uses Cordova.
  16. Like
    Tom Atom got a reaction from DanielKlava in Slow rendering into RenderTexture   
    Finally found solution!
     
    When rendering into RenderTexture with renderXY() there is lot of OpenGL settings in Pixi. Even if you use the same texture as target, these settings are repeatedly set for every single call to renderXY().
     
    renderXY() renders one display object a time. So, if you want to save time, avoid repeated setups and benefit from batching, you have to envelope all your drawings into one call. Phaser.Group is also display object, so I created group which is not added into scene. Under this group I built pool of sprites. When I need to render full screen line by line, I then set sprites from this pool and in the end I send only one renderXY() call with group as parameter.
     
    Results:
    - iPad Air: speed increased from 750 milliseconds to 50 milliseconds,
    - Lumia 532: speed increased from 9250 milliseconds to 190 miliseconds!
  17. Like
    Tom Atom got a reaction from Befive.Info in [Phaser] Jewel Jungle   
    Jewel Jungle is simple match-3 game focused on fast gameplay and pure matching. There are no special gems, but you are given simple tasks you have to fulfil in 150 levels with limited time or steps. Or you can choose Time Attack mode and target highest score.
     You can play the game here: https://play.famobi.com/jewel-jungle
     
     
     This game was made as exclusive reskin of our game Flat Jewels Match 3 (http://sbc.littlecolor.com/flatjewels/) for Famobi. We are still open for licensing original game, which is whole made in modern flat design or in making other exclusive reskin for customer's need:

  18. Like
    Tom Atom reacted to fitness23 in [Complete] Bayou Island - Point and Click Adventure Game   
    Hi everyone, I just wanted to announce that my first game created within Phaser is now on the App store and Google Play store. It's completely free!
    App store = https://itunes.apple.com/gb/app/bayou-island/id1152316984?mt=8
    Google Play store = https://play.google.com/store/apps/details?id=bayou.Island
    For the past year I've been creating an old school point and click adventure game. You can talk to npcs, pick up items, walk through doors to other rooms among many other features.
    The game is fully scripted using a json file. So you can lock doors, animate target zones, make npcs move in the scene, make certain lines of dialog available/unavailable and so on. The game also auto-saves for the user and saves local storage on their device for this feature to work. Since the game can be fully scripted and is scalable a 100 room game could be achievable. That's my next goal in taking this further.
    Here is the official game description:
    Make your way through this thrilling old school style point and click adventure game and try to solve the mysterious circumstances plaguing Bayou Island.
    Help an unknown captain make his way through the mysterious Bayou Island and try to find a way back to his ship. Solve the various puzzles and talk with the island's inhabitants to uncover what is really going on. But is something sinister afoot? Who is telling the truth? Who can you really trust? Using your logic is the only way you're going to win. This has been made with the love and inspiration of the point and click adventure games of the 90s.
    Bayou Island is completely free-to-play and there are no in-game purchases.
    Bayou Island features:
    This app is free-to-play and there are no in-game purchases
    Gorgeous graphics that will make you wanting more
    Beautifully composed original music
    Easy to use controls
    Rich storyline which progresses when each puzzle is solved
     
    Promo Web site = http://www.andy-howard.com/bayou-island/
  19. Like
    Tom Atom reacted to lumoludo in [Book & Game] Goblin Run - Procedural endless runner   
    Just an FYI, but the link you included in the post has a typo. I was able to figure it out and give the game a play though.

    Really polished looking game you have here! Definitely a good job done with the scaling too, which you mentioned. I know getting the scaling to work just the way I wanted it was a little tough the first time around, so I'm sure the book will be a valuable resource for those looking for help. I hope you have a lot of success with it!
  20. Like
    Tom Atom got a reaction from michaelcalkins in How to adapt to different aspect ratios   
    Hi, with different aspects you have generally two options:
     - keep displayed world always the same size and stretch it vertically or horizontally to fill screen,
     - or keep aspect and display more / less from you world vertically or horizontally
     
     ... or you can use combination of above two. This is what I do. I took iPhone and iPad as two extremes and between their aspects I am using the second (displaying more or less) ... it means from aspect 1.775 (1136/640) to 1.333 (1024/768) there is no distortion of image. If the device has more extreme screen dimensions and method 2 (show more or less) is not enough, then I stretch the image to fill remaining space.
     
     To achieve this I am using USER_SCALE. All you need to do is calculate your game dimensions and your x and y scales. I wrote detailed blog post on it here: http://sbcgamesdev.blogspot.cz/2015/04/phaser-tutorial-manage-different-screen.html
  21. Like
    Tom Atom got a reaction from douglas in Uncaught TypeError: c.Physics.Box2D is not a constructor   
    Box2D is not part of Phaser by deafult. You need to add script in your index.html like:
    <script src="js/phaser.min.js"></script> <script src="js/box2d-plugin-full.js"></script>  
  22. Like
    Tom Atom reacted to yahiko in Phaser Modules/Namespaces "Export"   
    You can even generate the tsconfig.json with this command:
    tsc --init Also, TypeScript 2.0 RC is quite stable and it is not a big risk to use it now:
    npm install -g typescript@rc  
  23. Like
    Tom Atom got a reaction from yahiko in Newbie Phaser questions (Unity & Construct 2 background)   
    Hi, there is no need to be afraid of Typescript. It is superset of JS and you can take JS code and put it into TS file ... and it works. If you are used to C# then TS will be closer to your habits than JS ... btw father of both C# and Typescript is Andres Hejlsberg (https://en.wikipedia.org/wiki/Anders_Hejlsberg) . Whatever you can do in JS you can do in TS, including calling other JS libraries. In TS you get type checking so you can catch lot of errors during development and intellisense increases productivity.
  24. Like
    Tom Atom got a reaction from symof in Sprite disoration, fake 3d   
    Hi, it is here: http://ds-code.net/?p=1
     
  25. Like
    Tom Atom got a reaction from Karthika G in how to add my custom Property to Phaser.Sprite (using TypeScript)   
    Hi,
     
     there are 2 oprtions:
     
    1) subclass Phaser.Sprite like:
    class MySprite extends Phser.Sprite {     private _myCustomProperty: number = 10;} 2) add property dynamically like:
    // write: sprite["myCustomProperty"] = 10;// read: console.log(sprite["myCustomProperty"]);  I use both ... most of times first one if I am also adding methods or more than one property or if I am using new property widely in code. Second if I am adding only one property and using it only on limited places in code (for example: in last game we have map with levels and I added level number in this way to level sprite as only place where I needed it was in on click callback)
×
×
  • Create New...