• Content Count

  • Joined

  • Last visited

Everything posted by lukaMis

  1. Hi I am working on a simple game that requires player to shoot a circle with another circle. Link: As you can see I only have couple of tweens and couple of sprites in game loop but still i have serious performance issues. My Samsung Galaxy S3 with Chrome can't keep steady 20fps. What i have done so far: - Game is 320 x 480 ( this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.setMinMax(320, 480, 512, 768) ); - Phaser.CANVAS in place of AUTO - Using phaser-no-physics.min.js so no heavy computation at all. - I have enabled game.renderer.renderSession.roundPixels = true; - I have moved info text from Phaser to DOM except for fps counter but that will be obviously removed. - Js is minified with console.logs removed Am i missing something / doing something wrong or is this normal. Any ideas how to optimize further? Tnx Luka
  2. Hi This is question about moving sprites efficiently around. I will be moving a few sprites around. I was going to use moveToXY but docs say sprite does not stop moving after it reaches destination and also there is no callback on XY reached. Should i use tweens to move sprites or custom checking in update function if x and / or y are reached and than do my stuff. Is there any other better approach? It seems redundant to keep creating tweens or am i wrong and they are in fact good and efficient way of moving sprites around. tnx Luka
  3. Hi I have game.input.onDown and listeners in game. I add listener for on game later than on sprite but listener for game triggers before event on sprite. Is there any way i can manipulate event flow. Similar to what we have in DOM events ( event.currentTarget event.preventDefault() event.stopPropagation() ) Can i stop event in game listener (if sprite was clicked too) or force event to trigger on sprite first under some condition?
  4. lukaMis

    Rotate the Gear

    I am sorry it is not in english. (It is translation ready via i18n.js but we only have slovenian texts so far). link: Goal is to rotate gray gear in the direction of its arrow using other gears and / or strap. Blue gear is starting point but you can not put strap directly on the two gears. There need to be some in between. You need to place gear from the left close enough to a rotating one so it will start rotating to... You have different size of gears (they rotate with different speed), strap icon and clear area icon. It is simple.... It is made with Phaser. This is part of our html5 powered textbook for fifth grade of primary school.
  5. lukaMis

    collision detection

    Tweens and physics do not mix particularly well. If you use physics system you should move your objects with physics forces not tweens. If you need physics just for collisions u can use overlap instead and move objects with tweens.
  6. lukaMis

    collision detection

    You are starting P2JS physics system and than checking for collide with arcade physics system. You can only have one system active in Phaser.
  7. Yes. You get images in your code from file-names of images in atlas not coordinates.
  8. Give them images correct file names before you pack them in atlas (blue.png, red.png, green.png) then you can reference them with that names. // (x, y, atlas_key, name_of_image_in_atlas) this.mySprite =, 0, 'atlas_key', 'name_of_image_in_atlas');
  9. lukaMis

    where to start? good luck, and have fun.
  10. lukaMis

    Babel, phaser 3 and atom

    I use Prepros. It has checkbox that you check for transpiling to es5.
  11. lukaMis

    [serious game] Word search

    This time i made demo in english. link: This game is part of our html5 powered textbook for seventh grade of primary school. It is a serious game as it uses game-like mechanic to teach chemistry. It is made with html5, css3, jquery... no Phaser here. Goal is to find all the hidden words by clicking on letters. (Do dragging, we support touch and mouse enabled devices.). Can you find them all? Texts are supplied via json, that means i can just load different words or different language or different subjects (physics, biology, ...)
  12. = true; Can that be set in like Boot state or it needs to be in main game state?
  13. lukaMis

    GUI - Html or Canvas

    It depends how much gui you have. A few buttons are easier wth phaser alone. If you plan dropdown menus and off-canvas navigation than css3 is your friend. Here is example that has gui in html&css3 and phaser for animation render. (Spoiler that is mine): There are no problems with mixing dom and canvas... Just structure you code appropriately. Phaser and jquery have very different ideas about code organization.
  14. Anyone doing ui in html over phaser canvas? If so how do you connect ui elements and methods in phaser states? Do you use one main global object?
  15. lukaMis

    Connect html ui and phaser canvas

    I was not thinking global globals like old school but one global object to namespace everything. Like this var MyGame = MyGame || {}; = new; MyGame.triggerUi =function () { // do UI magic here } ; Atm I structure stuff like this. As I am Always looking for better options that is the reason I started this topic.
  16. lukaMis

    Rotate the Gear

    Interlocking would be great, i agree. Our designer has chosen wrong gears i guess. Gears of different sizes rotate with different speeds. That is all there is to it. This is part of our html5 powered textbook and serves as simulation/aide/presentation for teacher when he/she explains this stuff to pupils. This is finished and in use.
  17. Where ever you set the x and y of a sprite. Just do this: mySprite.x = Math.round(value): mySprite.y = Math.round(value): or mySprite =, Math.round(value), 'key');
  18. lukaMis

    Move along predefined path with Phaser

    You can just not tween rotation in some tweens or if you must you can save and pass it in tween: var _angle = this.mySprite.angle; this.mySprite.moveTween = { x: some_value, y: some_value, rotation: _angle }, 1000, Phaser.Easing.Sinusoidal.InOut, true); or you can save it as property of your sprite and tween it this.mySprite.myNewAngle = 90; this.mySprite.moveTween = { x: some_value, y: some_value, rotation: this.mySprite.myNewAngle }, 1000, Phaser.Easing.Sinusoidal.InOut, true);
  19. lukaMis

    Going from Spritesheet to Texture Atlas

    When you use atlas there is an additional argument you need to pass to add sprite function: // (x, y, atlas_key, name_of_image_in_atlas) this.mySprite =, 0, 'atlas_key', 'name_of_image_in_atlas');
  20. lukaMis

    Little Hero [my first game]

    How is performance with Intel XDK?
  21. lukaMis

    Move along predefined path with Phaser

    How can path be predefined and dynamic? Mybe write what are you trying to do and post whole code sample.
  22. lukaMis

    localStorage from phaser

    Isn't using game engine for an online ad an overkill? Phaser alone is over 700kb.
  23. lukaMis

    Anyone using ES6 yet?

    I use it mainly for let in for loops over var and fat arrow anonymous functions as they now what value of this should be so there is no need for shenanigans of type var self = this before set function.
  24. Sublime text 3 Prepros Source tree Phaser, create.js, jquery, tweenmax, snap.js, ... Sass Texture packer