Jump to content

Tom Atom

Members
  • Content Count

    594
  • Joined

  • Last visited

  • Days Won

    6

Reputation Activity

  1. Like
    Tom Atom got a reaction from Karthika G in Phaser App in Visual Studio community   
    Hi,
     first, box2D does not need custom build of Phaser. It works well with deafult build.
     To make it run, be sure you have all these scripts in index.html:
    <script src="js/phaser.min.js"></script> <script src="js/box2d-plugin-full.js"></script> <script src="js/your_game.js"></script>  Make sure, you have defs (phaser_box2d.d.ts) where VS can find it (are you using lib folder?)
     In game, make sure you first initialize physics system:
    this.game.physics.startSystem(Phaser.Physics.BOX2D); var physics = <Phaser.Physics.Box2D>this.game.physics.box2d; if (physics !== null) { console.log("box2D initialized"); }  
  2. Like
    Tom Atom got a reaction from drhayes in Pre-wrap words when printing Letter-by-Letter?   
    Unfortunately only if using bitmap font, but looking into Phaser's source \src\gameobjects\Text.js can you bring on right way. Look into measureLine() method. It calls measureText() method of canvas context with single character.
  3. Like
    Tom Atom got a reaction from BunBunBun in Rotating a sprite.body around the point with keeping the orientation   
    Hi, to achieve, what you want just: create Phaser.group and your platform (Phaser.Sprite?) as child. Then in group's update rotate whole group and counter-rotate child platform with the same amount. This is working example (just add platfotm sprite):
    var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render}); var platform; function preload() { game.load.image('platform', 'platform.png'); } function create() { var graphics = game.add.graphics(400, 300); graphics.beginFill(0xFF0000, 1); graphics.drawCircle(0, 0, 5); var parent = game.add.group(); parent.position.set(400, 300); platform = game.add.sprite(100, 0, "platform", 0, parent); platform.anchor.set(0.5, 0.5); game.physics.arcade.enable(platform); parent.update = function() { this.angle += 0.5; platform.angle -= 0.5; } } function render() { game.debug.body(platform); } Red circle is there only to show center.
  4. Like
    Tom Atom reacted to symof in Rotating a sprite.body around the point with keeping the orientation   
    It's just math and collisions, and the hard part (collisions) is handled by phaser.
    https://jsfiddle.net/7orw0xxr/14/ 
    You can do this a number of ways. You can calculate it based on the platform.body current x & y and set the new coords for your player, or object.
  5. Like
    Tom Atom got a reaction from symof in Rotating a sprite.body around the point with keeping the orientation   
    Hi, to achieve, what you want just: create Phaser.group and your platform (Phaser.Sprite?) as child. Then in group's update rotate whole group and counter-rotate child platform with the same amount. This is working example (just add platfotm sprite):
    var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render}); var platform; function preload() { game.load.image('platform', 'platform.png'); } function create() { var graphics = game.add.graphics(400, 300); graphics.beginFill(0xFF0000, 1); graphics.drawCircle(0, 0, 5); var parent = game.add.group(); parent.position.set(400, 300); platform = game.add.sprite(100, 0, "platform", 0, parent); platform.anchor.set(0.5, 0.5); game.physics.arcade.enable(platform); parent.update = function() { this.angle += 0.5; platform.angle -= 0.5; } } function render() { game.debug.body(platform); } Red circle is there only to show center.
  6. Like
    Tom Atom got a reaction from drhayes in Rotating a sprite.body around the point with keeping the orientation   
    Hi, to achieve, what you want just: create Phaser.group and your platform (Phaser.Sprite?) as child. Then in group's update rotate whole group and counter-rotate child platform with the same amount. This is working example (just add platfotm sprite):
    var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render}); var platform; function preload() { game.load.image('platform', 'platform.png'); } function create() { var graphics = game.add.graphics(400, 300); graphics.beginFill(0xFF0000, 1); graphics.drawCircle(0, 0, 5); var parent = game.add.group(); parent.position.set(400, 300); platform = game.add.sprite(100, 0, "platform", 0, parent); platform.anchor.set(0.5, 0.5); game.physics.arcade.enable(platform); parent.update = function() { this.angle += 0.5; platform.angle -= 0.5; } } function render() { game.debug.body(platform); } Red circle is there only to show center.
  7. Like
    Tom Atom reacted to symof in Problem with hero and tiles when not moving   
    So I'm guessing you have something like this one here:
    https://jsfiddle.net/ya22nbdr/
    And my solution to it:
    https://jsfiddle.net/ya22nbdr/1/
    I think this is not really a bug as the collision gets triggered but the platform stuff overrides the wall physics, because I don't use arcade to move the platform with body.velocity but I used the sprite.x instead.
     
  8. Like
    Tom Atom got a reaction from P4UL in re-use state for different maps   
    Hi, when you call game.state.start, you can add multiple optional parameters:
    game.state.start("Mystate", true, false, param1, param2); These parameters are then passed to init() method, if you have any in your state (init is called as first before create()).
    With this, you can pass variables from state to state. You can still combine it with inheritance solution and have cleaner code.
  9. Like
    Tom Atom got a reaction from arialblack14 in TypeScript preload onFileComplete - Error: Phaser.Signal: listener is a required param of add()   
    Hi, here is Typescript skeleton I use - each state has its own class (and file). Use types - this is one great thing Typescript gives you: it helps you to find errors and prevents you from doing them:
    // -------------------------------------------------------------------------// -------------------------------------------------------------------------// -------------------------------------------------------------------------window.onload = () => { new MyGame.Game();};// -------------------------------------------------------------------------// -------------------------------------------------------------------------// -------------------------------------------------------------------------module MyGame {    export class Game extends Phaser.Game {        // -------------------------------------------------------------------------        constructor() {            // init game            super(800, 480, Phaser.AUTO, "content", null /* , transparent, antialias, physicsConfig */);                        // states            this.state.add("Boot", Boot);            this.state.add("Preloader", Preloader);            this.state.add("Menu", Menu);            this.state.add("Levels", Levels);            this.state.add("Play", Play);            // start            this.state.start("Boot");        }    }}// -------------------------------------------------------------------------// -------------------------------------------------------------------------// -------------------------------------------------------------------------module MyGame {    export class Boot extends Phaser.State {        // -------------------------------------------------------------------------        constructor() {            super();                :        :    }        // -------------------------------------------------------------------------        init() {            if (this.game.device.desktop) {                :         :            }            else {                :         :            }        }        // -------------------------------------------------------------------------        preload() {                :         :        }        // -------------------------------------------------------------------------        create() {                :        :        }        // -------------------------------------------------------------------------        update() {                :        :        }    }}// same classes for other game states like "Boot" class (... usually without init() method) Look at my small tutorial for simple Phaser Typescript game here: http://sbcgamesdev.blogspot.cz/2015/05/phaser-tutorial-dronshooter-simple-game_23.html
  10. Like
    Tom Atom got a reaction from Riddle in Phaser Modules/Namespaces "Export"   
    Here is new project: practice.zip
    Do this changes:
    tsconfig.json - you have to change paths to source files, so compiler knows where to look for it: { "compilerOptions":{ "module": "commonjs", "target": "ES6", "sourceMap": true, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "files": [ "phaser/phaser.d.ts", "states/practice-gamerunning.ts", "states/practice-titlescreen.ts", "practice1.ts" ] }  import.d.ts - again: simplify paths and delete rest of file. Whole file is now: /// <reference path="phaser/phaser.d.ts" /> /// <reference path="states/practice-gamerunning.ts" /> /// <reference path="states/practice-titlescreen.ts" /> /// <reference path="practice1.ts" /> adjust practice1.html - correct paths (delete leading slash): <html lang="en"> <head> <meta charset="utf-8" /> <title>Hello Phaser</title> <link rel="stylesheet" href="app.css" type="text/css" /> <script src="phaser/phaser.js"></script> <script src="practice1.js"></script> <script src="states/practice-gamerunning.js"></script> <script src="states/practice-titlescreen.js"></script> </head> <body> <div id="content"></div> </body> </html> => it now compiles without errors...
     
     
     
  11. Like
    Tom Atom got a reaction from Riddle in Phaser Modules/Namespaces "Export"   
    To be honest, I do not know...  Only example I found was here (https://www.typescriptlang.org/docs/handbook/namespaces.html) with nested namespaces
    namespace Shapes { export namespace Polygons { export class Triangle { } export class Square { } } } import polygons = Shapes.Polygons; let sq = new polygons.Square(); // Same as 'new Shapes.Polygons.Square()'  
    Your SimpleGame object extends Phaser.Game, so SimpleGame IS Phaser.Game. You can define constructor for your SimpleGame like:
    public constructor(width: number, height: number) { let renderer = Phaser.AUTO; if (something) { renderer = Phaser.CANVAS; } super(width, height, renderer, "content"); }  This is just example, but you can now pass width and height. Inside constructor renderer is set based on some code and conditions. Finally, call to super constructor passes all these as arguments along with "content". It is up to you, what you put into arguments and what you set inside constructor. Important is, that SimpleGame IS Phaser.Game, so it sets game loop and so on. It then check states for methods like create, preload, update, ... and if found, it calls it.
     
    This is similar. As you extend Phaser.State, then your TitleScreenState is Phaser.State. So, it inherits all properties and methods of Phaser.State object and you can call it from your derived class. "game" property is one of these inherited properties.
    I do not know, whether you have some OOP (Object Oriented Programming) knowledge? If not, then look for "Inheritance", "Polymorphism" and "Encapsulation" - three basic OOP concepts.
  12. Like
    Tom Atom got a reaction from Riddle in Phaser Modules/Namespaces "Export"   
    Hi, get file below. It should now work. I made lot of small changes, probably I will forgot some here, so go through files to see it. I added folder with phaser engine and d.ts files, but it was not problem (I was just missing it as you have it somewhere else on disk)
    index.html - be sure to always add all scripts. If you passed your compilation errors, you would be missing scripts here. Change it to (do not forget to change back path to Phaser): <html lang="en"> <head> <meta charset="utf-8" /> <title>Hello Phaser</title> <link rel="stylesheet" href="app.css" type="text/css" /> <script src="phaser/phaser.js"></script> <script src="practice1.js"></script> <script src="practice-gamerunning.js"></script> <script src="practice-titlescreen.js"></script> </head> <body> <div id="content"></div> </body> </html> there was error in practice-titlescreen.ts. Change: titleClicked (){ this.state.start("GameRunningState"); }  to
    titleClicked (){ this.game.state.start("GameRunningState"); } leave only this in import.d.ts: /// <reference path="practice-gamerunning.ts" /> /// <reference path="practice-titlescreen.ts" /> /// <reference path="practice1.ts" /> !!! remove "export" in front of "namespace" in all files !!! very important. paths in reference should be relative to file in which it is used. Notice I deleted all that wild pathes. (do not forget to change back phaser reference in practice1.ts) Here is working project: practice.zip
  13. Like
    Tom Atom got a reaction from Riddle in Any up to date Phaser-Typescript tutorials for beginners?   
    Hi, some time ago I wrote small 3 part tutorial on making small game: http://sbcgamesdev.blogspot.cz/2015/05/phaser-tutorial-dronshooter-simple-game.html
    It should be still valid. It is small game using P2 physics.
  14. Like
    Tom Atom got a reaction from spinnerbox in Making a graphic Rectangle clickable   
    Hi, this is clickable rectangle without hitArea:
                // play button            var g = this.add.graphics(0, 0);            // draw a rectangle            g.lineStyle(2, 0x0000FF, 0.5);            g.beginFill(0xFF8080, 1);            g.drawRect(this.world.centerX - 50, this.world.centerY - 50, 100, 100);            g.endFill();            // input            g.inputEnabled = true;            g.events.onInputDown.add(function () {                console.log("Pressed ...");               }, this);  events and inputEnabled are properties of graphics, not hitArea. Second, you are missing "this" parameter in your onIputUp setup.
     
    If you want to add hit Area, do for example this:
    g.hitArea = new PIXI.Circle(0, 0, diameter); hitArea can be any object that has method: contains(x: number, y: number) returning boolean. In PIXI it is Circle, Ellipse, Polygon, Rectangle.
  15. Like
    Tom Atom reacted to marcgfx in [WIP] Devader (AntiMiner)   
    In the last few weeks I was too lazy to write, but quite a lot has changed.
    The most important changes are that the game has been renamed to Devader and the game link is now:
    http://data.cyberlympics.com/html/game.html?param=Devader_1
    - tentacles are a lot easier to destroy
    - more extra drops
    - improved performance (still more to do, e.g. the profiler tells me the minimap is pretty terrible)
    worked on the tower boss. it now shoots devastating lasers at you, I think it's still too difficult

    worked on the final boss, aka adios boss. there are now tentacles coming from the main body

    I started working on visualizing the weapon power ups last friday. They are stackable, what I find very cool, but also poses some bigger problems. You can end up making so many bullets, that performance will be impaired. My solution is to make the pickups time out.
    The time-out is not obvous for the player. So my original idea was to add the power-up symbol to the GUI and maybe add a visible countdown or let it start blinking shortly before the power-up is used up. As I am using a combination of HTML and WebGL this is actually not that easy. The power-up image is in a texture atlas and the color of the power-up is done by the shader. This means I would need to do a hybrid HTML-WebGL GUI. Unfortunately not that easy, as the screen can zoom. To make things worse, I am considering making the game 2 Player. Everything I paint in WebGL normally would get rendered in both views. If I want to add WebGL GUI elements, this would require me to change the data for the second player. Kind of a lot of work for something I don't think would look that great anyway.
    So I came up with a new plan of adding the power-ups to the bot. I decided to place them around the waist at first. This took me far too long to achieve and I was everything but happy with the result. It was kind of cool, but it was not really visible. The amount of collectable power-ups is unlimited, so I can't make them big.

    After some sleep I came up with the simple idea: limit the power-ups to 3 and display them on the back. much better! 

    They seemed a little out of place, so I reduced the size slightly again:

  16. Like
    Tom Atom got a reaction from CharlesCraft50 in [Phaser] Summer Love   
    Summer Love is small infinite horizontal runner made in Phaser. That weird name comes from fact it should promote some summer music festival with this name.
    Later in game there are spikes and if you pick heart, you can do additional in-air jump. Hero's animation was made with Spriter (tool for skeletal animations).
    Game is controlled with space or left mouse button.
    Play it here: https://www.gameeapp.com/game/kiBJvHa

  17. Like
    Tom Atom got a reaction from ecv in [Phaser] Shards - the brickbreaker   
    @ecv Wow! I am really impressed with your review and thanks very much for time you spent on it and on game itself!
     I do not know, whether I am professional or not. It is just two years since I decided to leave my non-IT job and start making games as freelancer (while game programming was always my hobby since Atari times). But what I know is, that other two guys who worked on game are trueprofessionals. Music is by Ján Dušek, who made for example this music ( https://www.youtube.com/watch?v=M72mO8YTt5g ) - I know him from past when he was making songs for smaller games. And while it is modern, I still feel in his songs something from good old times when music had melody. Graphics is by Petr "Jupiter" Víšek, who was making textures and models for ARMA games in past and now works on truck games. We met deep in past in gameboy times ( http://sbcgamesdev.blogspot.cz/2012/10/projects-history-part-ii-gameboy.html ) and our first game, we made together was Tom Atom
     Backgrounds for game was made in Apophysis ( http://www.apophysis.org/index.html ) and adjusted in Photoshop. Apophysis is program for fractal generation and you can spend ages in it!
     Regarding localization - it is out of our controll. Usually sponsors are asking to put translations they deliver into game or just asking you to make game "translation ready". In fact, even if we did it by ourselves, I can not say it would end better. It is quite an effort consuming task, especially for small team. You can get crappy translations with Google translator or good ones if you find (native) speakers. We did this with our older native games, but then every small change requires check with all translators again.
     Bombs - yes, they can sometimes make you really angry You are right, that spreading would help and bonus - bonus collision should do the trick.
     UK flag - I did not want to have any flags in it, but most of the levels were designed by Jupiter and he said, that UK flag is part of 80's culture and as our game is Arkanoid/Breakout clone, that reffers to that time, we should have it there. My personal symbol of 80's is Atari logo, but using others logos in your game may be problematic. I believe, that UK flag is royalty free! And enfurance... it often depends on bonuses you get - flag is not protected with any barrier, so if you get laser, it can be destroyed quite quickly. This was little problem when testing and balancing levels. Some were so hard, that friend of mine told me: "ball got stuck in upper area, so I took a shower and when returned, ball was still there". I do not say all levels are balanced well, but at least are possible to finish.
     Trails, bug, effects - game was made with box2d Phaser plugin. Both box2D and Phaser are great. But I still feel little, that HTML5 world (browsers, mobiles) is not yet prepared for gfx/cpu intensive games. In the end we had to add another set of graphic assets for low-end devices, that is only 40% of original size (0.4 * 0.4 = 16% area), we had to switch off all trail particles and reduce shrads particles. Also only one in-game music instead of 4 is played if low-end device is detected. And it is not still enough on some mobiles... Shards was originally native game and we were using box2d there too. It runs without any problems on very old devices. For example on old Galaxy Tab it runs most of the time with all efects on 50-60 FPS. HTML5 version hardly runs at all on this device, even with all effects off.
     Once more, thanks for your feedback!
  18. Like
    Tom Atom got a reaction from spinnerbox in How does bezier curve drawing works?   
    Haha, yes! bezier curve with (400, 400, 450, 450, 500, 500) will draw straight line. Because the control point, that "makes curvation" is on straight line between start and and point.
    Change it to this: graphics.bezierCurveTo(400, 400, 500 , 400, 500, 500); to get nice arc:

     This is exactly explained on that video. Really recommend to see it. Bezier curve does not go through control points - it is only "attracted" to them. If you need to go through control points, then you need to use Catmull-Rom curve.
    Edit: looking into source, Phaser / PIXI says:
    /** * Calculate the points for a bezier curve and then draws it. * * @method bezierCurveTo * @param cpX {Number} Control point x * @param cpY {Number} Control point y * @param cpX2 {Number} Second Control point x * @param cpY2 {Number} Second Control point y * @param toX {Number} Destination point x * @param toY {Number} Destination point y * @return {Graphics} */ PIXI.Graphics.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY) So, it is not quadratic, but cubic bezier curve and first point is given with current poision (moveTo() or end of previous drawing). Then you are passing only 2 control points and end point.
  19. Like
    Tom Atom reacted to oddkraken in [WIP] Orange Sea - my first game   
    I started learning Phaser a few weeks ago and have been having a blast making this game. It's still very much a work in progress, but it has one short chapter with some hazards.
    I've experimented with mobile compatibility, but so far haven't been happy with the results, so please try it out on a desktop browser.
    Being my first game, I just kind of dove right in, so I'm sure I'm breaking lots of design rules, and I would really appreciate any feedback. I'm specifically concerned about the difficulty - it's tough to tell if a game is too hard when you've been playing it for hours on end. I'm hoping most people can get the hang of it and get to the end of the level after several tries, but I think it's rather challenging now.
    Thanks for taking a look, and have fun!
    Direct game link: orangesea.oddkraken.com
  20. Like
    Tom Atom got a reaction from erest0r in Class: Weapon, Method: fire(), is requiring first parameter when using typescript   
    Hi, from time to time you can find small problem like this in typescript definitions in phaser.d.ts. In this case you can change it from:
    fire(from: any, x?: number, y?: number): boolean; to
    fire(from?: any, x?: number, y?: number): boolean;  and parameter becames optional.
     You can report it on GitHub, so it gets corrected in next Phaser versions.
     
  21. Like
    Tom Atom reacted to samme in Phaser Scene Graph plugin   
    Prints Phaser’s display tree. Demo / GitHub / NPM
    npm i phaser-plugin-scene-graph

  22. Like
    Tom Atom reacted to samme in Phaser Debug Arcade Physics plugin   
    Draws properties of Arcade Physics bodies. Demo / Code
    npm i phaser-plugin-debug-arcade-physics  
  23. Like
    Tom Atom reacted to ecv in [Phaser] Shards - the brickbreaker   
    -Hey let's make a cool brick breaker
    -Is that even possible?
    IT IS. It's called Shards.
    Quite obviously a professional game. I'm not very sure how useful it is to give feedback about a professional game, specially when it wasn't explicitly requested, but for some reason I feel compelled to do so, perhaps because it's a wonderful game, maybe because I've spent over 3hrs playing it (ads time excluded), or maybe because I feel that if I was in the shoes of the makers I'd like to hear what I've got to say.
    As I said, I've spent well over 3 hours playing it... until I beat the game. So since I already gave you literally my 2 cents, I might as well just give them figuratively:
    I'm far from a good gamer, even further from a brick breaker fan; yet I played all levels in a row. This, at the very least means the game is good; turns out it's great. I decided to give it a go before dinner (BAD. DON'T DO THIS!), which I missed so far, along with the sleep schedule. By level 20 I was tired, but why not keep playing since I'm doing great? By level 70 I was exhausted, but I HAD to finish the game; it was a matter of honor now. Man I got some wrist pain. By the end of the game I was a SHARDS zombie.
    The backgrounds are BEAUTIFUL. BEAUTIFUL, BEAUTIFUL, BEAUTIFUL. They are eye-pleasing.
    The levels are nice. I like how blocks can be of any size, rotated in any way, and how they're arranged to create beautiful and interesting levels.
    The music is great. I might find myself listening to similar music on occasion. The different tracks are refreshing and the style fits perfectly with the game.
    All power-ups are listed in the help section. Of course I didn't try to memorize them; you just learn them as you go in the game, when you've spent enough time playing.
    I like how balls collide with each other, making things more interesting. I like how when you haven't hit a block for a while, a new ball will pop in. Smart move, not only in regards of preventing player's frustration, but also in terms of speeding up the game. I like the laser cannon and how the stick ball leaves snots everywhere it bumps. I like how you could get an extra life in most if not all levels.
    Needless to say, the game play is great. The shard effects and all.
    Now there are a few "problems" I'd like to comment:
    Firstly, I was impressed with the game localization/translation. But since you're at it, it'd be nice if you minded regions. While essentially, peninsular Spanish and Latin American Spanish are understandable for speakers of each other side, just as, I presume, happens with British and American English, there are linguistic formalisms and spare words which simply put, sound odd. Such is the case of "puntaje" or "felicitaciones". The former sharing the root "punt" with its Peninsular counterpart "puntuación", aside from that and while its suffix makes sense in Peninsular Spanish, its usage in this case doesn't. Similarly the later would mean a pluralization of congratulating in Peninsular Spanish, instead of simply "congratulations". Also maybe "level" is quite common a word among the general public over Latin America but it certainly isn't in Spain, unless you're a declared gamer or can speak some English, and I'd say it should be translated.
    The bombs are not only hateful because you get killed if you mistakenly get in their way, but for a couple more reasons: if the ball and the bomb share a similar trajectory and position, you're doomed; if you don't hit the ball you die, if you hit the bomb you die. You see a powerball (BTW it looks like a black hand?) and go get it, uh oh, there was a bomb underneath: ka-boom. I'd propose replacing the bomb with a glue blob that will temporarily disable the platform,racket,pad (whatever the player character is called) from moving; it's not as drastic a punishment as losing a life. Also, it might be a good idea to make the power-ups collide just between themselves (and walls I guess), so they can be spread out and offer a greater chance of avoiding the bad ones while getting the good ones, and overall make it all less confusing.
    The UK flag. Okay, that's nice for a change from the usual US flag embedded virtually in every culture worldwide. But man, I learnt, and I did so strongly about the British Empire endurance! This is by far the level I spent most time on, with nearly 8 minutes, as bricks just didn't seem to want to break as easily.
    I don't suppose you can do much about this one: I occasionally found my platform wasn't responding. "Hey, what's going on?" Then I raised my eyes just to find the mouse cursor hovering off the game screen, around the browser title bar, etc. I guess web browsers won't allow JS to take control of the mouse cursor as this could be considered a security feature...
    The cuts to ads are abrupt. I understand you wouldn't want your player to waste extra time, but maybe you could use a second to fade out music and screen. I don't think a fade in is needed after the ads.
    I'd like some trail effect on my platform. Although I guess this might no be too visible on touchscreen devices.
    And finally, I'd go as far as calling this one a bug: When the crystal balls are too tight, and collide endlessly, they will introduce considerable lag. This is specially noticeable at level 78 (rocket), where the game turned hardly playable, until I got to destroy that pesky ball.
    A final note: I understand games aren't made with the move of a magic wand. Often, my comments might look as if more emphasis was put in the bad points than in the good ones, given the amount of text that goes with each. I guess this could be kind of upsetting, given the time and effort that was put into making a game. I'd like to make clear that when it comes to the good points, there's hardly anything else I can say other than praising them, whereas for the bad ones, I feel compelled to sustain them with details and reason to provide as much food for thought to work with as possible. The amount of text I put emphasizing each point doesn't amount to the quality of such point. Simple as that. Moreover, if I spend a considerable amount of time playing your game (quite obviously for me) it means I like it, even if having only stressed the negative points of it! I might need to make this my signature just so that some game developers know what I'm getting at with my comments!
    I might have missed a few points, since my mind was already in a broken state after so much playing . I'll correct tomorrow if such is the case.
     
  24. Like
    Tom Atom got a reaction from ecv in [Phaser] Shards - the brickbreaker   
    Hi, in past days we finished our game Shards - the brickbreaker. Game was originally for Android / iOS, but with help of Phaser box2D plugin we made web version, so everyone can play in browser.
    Shards features are:
    80 levels, each level has its own original stunning fractal background, glassy bricks are of arbitrary sizes and rotate to bring you interesting patterns to destroy, ten power-ups will help you to clean the board, two types of glassy enemies, listen to an original soundtrack, play through three difficulty levels You can play the game here: https://play.famobi.com/shards/

  25. Like
    Tom Atom got a reaction from cybearg in [SOLVED] Typescript Method Undefined   
    There is a few methods, that Phaser recognizes. It checks if it is present in object you passed as state and if yes, it calls it. Look at this old post:

     In your case, when you put something inside { ...} then it is object. So, inside of your Game object, you are calling new Phaser.Game, but you are passing it anonymous object, that has preload, create and update methods - nothing more. You define its methods like preloader: this.preloader, which only says: "hey, for preloader method/function for this anonymous object use preloader method/function from my Game class". That anonymous object has only those three methods you defined - collectStar is missing. You can also modify your code like this and it will work:
    this.game = new Phaser.Game(800, 600, Phaser.AUTO, "content", { preload: this.preload, create: this.create, update: this.update, collectStar: this.collectStar });  Now, that object also has collectStar method. You could also create that object with mixing different methods from different objects: {preload: this.hello, create: other.someMyMethod, update: another.whatever, collectStar: myLibrary.collectStar}. With JS/TS, you can get pretty wild
     And what Phaser does with passed "State" object? It depends on what was passed to it:
    if (state instanceof Phaser.State) { newState = state; } else if (typeof state === 'object') { newState = state; newState.game = this.game; } else if (typeof state === 'function') { newState = new state(this.game); }  In your case, second was used - this is why "game" reference appeared inside of your state. Later it also links other shortcuts automatically:
    link: function (key) { this.states[key].game = this.game; this.states[key].add = this.game.add; this.states[key].make = this.game.make; this.states[key].camera = this.game.camera; this.states[key].cache = this.game.cache; this.states[key].input = this.game.input; this.states[key].load = this.game.load; this.states[key].math = this.game.math; this.states[key].sound = this.game.sound; this.states[key].scale = this.game.scale; this.states[key].state = this; this.states[key].stage = this.game.stage; this.states[key].time = this.game.time; this.states[key].tweens = this.game.tweens; this.states[key].world = this.game.world; this.states[key].particles = this.game.particles; this.states[key].rnd = this.game.rnd; this.states[key].physics = this.game.physics; this.states[key].key = key; }  
×
×
  • Create New...