• Content Count

  • Joined

  • Last visited

About tembac

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks! That worked. Now I don't know why the filter texture covers all the screen if it is smaller: var group = this.add.group(); this.back = this.add.image(0,0, "roomText", "Background 8"); group.add(this.back); this.glass = new Phaser.Sprite(this.game, 0,0, "displaceImg"); this.filter = new FilterGlass(this.game, this.glass.texture); group.filters = [ this.filter ];
  2. Thanks for your help! Now I'm closer but can´t be able to move or set the size of the filter. export default class extends Phaser.Filter { constructor (game, texture){ super(game); // set the uniforms this.uniforms.displacementMap = {type: 'sampler2D', value:texture}; //distorsión. this.uniforms.scale = {type: '2f', value:{x:75, y:75}}; //movimento. this.uniforms.offset = {type: '2f', value:{x:120, y:120}}; this.uniforms.dimensions = {type: '4fv', value:[0,0,0,0]}; this.uniforms.mapDimensions = {type: '2f', value:{x:0, y:0}}; this.uniforms.resolution = {type: '2f', value:{x:1, y:1}}; this.uniforms.mapDimensions.value.x = texture.width; this.uniforms.mapDimensions.value.y = texture.height; this.fragmentSrc = [ 'precision mediump float;', 'varying vec2 vTextureCoord;', 'varying vec4 vColor;', 'uniform sampler2D displacementMap;', 'uniform sampler2D uSampler;', 'uniform vec2 scale;', 'uniform vec2 offset;', 'uniform vec2 mouse;', 'uniform vec4 dimensions;', 'uniform vec2 mapDimensions;', 'void main(void) {', ' vec2 mapCords = vTextureCoord.xy;', ' mapCords += (dimensions.zw + offset + mouse )/ dimensions.xy ;', ' mapCords.y *= -1.0;', ' mapCords.y += 1.0;', ' vec2 matSample = texture2D(displacementMap, mapCords).xy;', ' matSample -= 0.5;', ' matSample *= scale / mapDimensions;', ' gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));', ' gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);', ' vec2 cord = vTextureCoord;', '}' ]; } }
  3. I want to implement this filter using Phaser CE 2.11 https://pixijs.io/examples/index.html?s=filters&f=displacement-map.js&title=Displacement#/filters/displacement-map.js But it seems like pixi filters were deleted from phaser CE repo on github. How can I use it? Thanks!
  4. Hi everyone, I'm having a problem going back from fullscreen on Android Crome. When the game is in fullscreen mode and the user presses the back button to minimize. The game gets bigger than the window so half the game screen is outside the mobile screen. How can I properly setup fullscreen?
  5. I did a lot of testing and started noticing that older games made with Phaser worked better on the ipad 3 that newer. I tried using Phaser 2.4.6 and now it is working a lot faster! Is there a problem with Phaser Ce that is making it slower? Edit: I did a little more testing and it starts working slower with the first Phaser CE version 2.7.5. It is 30 fps and slower. The same game using Phaser 2.6.2 goes between 50 and 60 fps.
  6. Following my previous post now I'm trying to use compressed textures to see if that will improve the performance on ipad 2 / mini gen 1. We are using texture packer to create the textures? What are the recommended pixel format settings? I tried a few that look very bad. How can I load an atlas with the texture? The current method doesn't seem to allow loading an atlas and several textures: https://photonstorm.github.io/phaser-ce/Phaser.Loader.html#texture Thanks for the help!
  7. Yes, with texture batching and reduced draw calls fps are still under 60. I don' see any improvement. Glitches appear if I define setTexturePriority. I'll upload my testings later. Now I'm trying to use compressed atlas textures but there is not a lot of documentation about this.
  8. These are the kind of glitches I'm seeing with texture batching. The symbols below should be bitmap fonts. It has to look like this:
  9. I tried multitexture batching using Richard tutorial with hopes that the performance will be improved https://phaser.io/tutorials/advanced-rendering-tutorial/part4 I made the test on my demo using phaser 2.8.2 https://github.com/Tembac/ChimangoGamesDemo (Demo is not updated with multi texture batching yet) Draw calls are a lot less now but I don't see any performance improvement. On some devices that I tested it is is also showing graphical glitches with several of the sprites. Canvas is still the faster render option on all the devices I try phaser on. Why is this? Maybe I'm doing something wrong? I tested on Ipad 3 and Nexus 6p. I made other tests on the past with slower android devices and canvas is always the best option.
  10. I uploaded a demo with some test. I'm using a mask for the texture and lines for the borders. I'll be glad to hear comments about this. I'm not sure yet what to do so the borders look nicer. https://github.com/Tembac/PhaserPolygonTextureDemo
  11. Hi everyone, We made a simple runner demo with Phaser that works as a base for all our future projects. We are using node modules to make our development easier. We shared it on github so more people can use it and learn from it: https://github.com/Tembac/ChimangoGamesDemo You can try it here: http://chimangogames.com/games/demoRunner/index.html It works great on every device we tested but some people reported that it is running slow on Ipad mini 1gen. We don't have that platform to test so it is hard for us to know how to improve it. Can someone give us tips on how we can improve performance for this demo on that platform? Thanks!
  12. Hi Everyone, I need guidance on how can I approach this problem: Would like to apply a tiled texture to complex polygons. I'm using P2 for the physics and tiled for the level editor. I would like to get something similar to worms where the terrain has a tiled texture, the top has grass and the bottom is darker. These are some examples of what I would like to achieve: I don't care at all about destructible terrain. This is how my level looks now with polygons from tiled: http://puu.sh/wMwsg/28b1609d74.jpg
  13. Solved! I need to use pixel perfect for click and for over. var btnFigura = new Phaser.Button(this.game, x, y, 'figura01UiImg', this.btnFiguraOnClick, this, "Figura01__" + pieceName + "_normal", "Figura01__" + pieceName + "_normal", "Figura01__" + pieceName + "_selected", "Figura01__" + pieceName + "_normal"); btnFigura.colorPiece = colorPiece; btnFigura.input.pixelPerfectClick = true; btnFigura.input.pixelPerfectOver = true; this.add(btnFigura);
  14. I tried with pixelperfect = true but I can't press the buttons that are behind the transparent areas.