• Content Count

  • Joined

  • Last visited

About JesusJoseph

  • Rank

Contact Methods

  • Twitter

Recent Profile Visitors

728 profile views
  1. Hi All, Thanks for reading. I am creating a Game using Phaser and Cordova. I use window.innerWidth to set the width of the game. It works correctly for the first time by returning the screen width. But after I closing the game by press the back button in my android mobile it's not working. When I open the game again the window.innerWidth is returning as 0 and not the screen width. I try to get the width using the below Cordova plugin but it's not working. Any help will really helpful. Tried for the whole day but nothing works.
  2. yes it working thanks for your help
  3. Thanks YuPi After I changed to version 3.10.1 then there is no error But still, I didn't see the gradient rectangle in my screen. In create function I have only below codes. But my screen is all black. Any help will be appreciated. var texture = this.textures.createCanvas('gradient', 200, 256); var context = texture.getContext(); var grd = context.createLinearGradient(0, 0, game.config.width, game.config.height); // ERROR LINE grd.addColorStop(0, '#FFFFFF'); grd.addColorStop(1, '#004CB3'); context.fillStyle = grd; context.fillRect(0, 0, game.config.width, game.config.height); // Call this if running under WebGL, or you'll see nothing change texture.refresh(); //Second one //---------------------------------------------------------------------------- var c=this.textures.createCanvas('gradient1', 200, 256); var ctx=c.getContext("2d"); // Create gradient var grd=ctx.createLinearGradient(0,0,200,0); grd.addColorStop(0,"red"); grd.addColorStop(1,"white"); // Fill with gradient ctx.fillStyle=grd; ctx.fillRect(100,100,150,80);
  4. I need to add a help content for the game. I need to set word wrap for the help content. In version 2 I use below code to set word wrap. But in version 3 its not working helpText.setTextBounds(16, 20, 768, 568); Can someone please tell me how to set word wrap in Phaser 3 Thanks for your help Full Code below var helpContent = "Help Content Come here" + "Help Content Come here" + "Help Content Come here"; var style = { font: "24px Arial", align: "left", wordWrap: true, wordWrapWidth: 450 }; var helpText = me.add.text(0, 50, helpContent, style); helpText.setTextBounds(16, 20, 768, 568);
  5. Thanks for your reply Now I am getting another error from the second line (var context = texture.getContext();) as below HomeScene.js:66 Uncaught TypeError: texture.getContext is not a function at HomeScene.create (HomeScene.js:66) at SceneManager.create (phaser.js:41315) at SceneManager.bootScene (phaser.js:41169) I am using Phaser 3.5.1
  6. I need to create a sky color background. I am planning to do it using a gradient rectangle using below code but I am getting below error at LINE 2 HomeScene.js:68 Uncaught TypeError: Cannot read property 'createLinearGradient' of undefined var texture = this.textures.createCanvas('gradient', 16, 256); var grd = texture.context.createLinearGradient(0, 0, 0, 256); // ERROR LINE grd.addColorStop(0, '#8ED6FF'); grd.addColorStop(1, '#004CB3'); texture.context.fillStyle = grd; texture.context.fillRect(0, 0, 16, 256); // Call this if running under WebGL, or you'll see nothing change texture.refresh(); Can someone please tell me how to create a gradient images. Thanks for your help.
  7. The best way is to set the animation in the preload Scene as @rich mentioned. This way we are not creating the animation every time the scene load. Please note that we need to create the animation inside the create function inside Preload and not inside preload function
  8. @Samme Thanks for your reply. After I changed the group to dynamic and set the gravity correctly then it's working correctly BUT the actual issue for me is I am moving the static/dynamic object by changing the x value inside the Update function. If I move the dynamic group object by changing the x value inside the update function then the collider or overlap function is not working. Only when I move the group objects using below code then its overlap is working as expected. this.letterA.setVelocityX(-160); Not sure its a bug or this is what @rich plan to code, like for dynamic objects we should move them only using setVelocity and not changing the x or y value inside update function. The sprite is working correctly even if we move it by changing the x/y value inside the update function.
  9. I am trying to check when a physics sprite and a staticGroup overlap. But the callback function is not called. there is not error Please note that if I change the staicGroup to group then its working. But the letters are falling down. But I need to move the letters from left to right and not falling. To move the static group objects from left to right I am updating the x value in the update function. Is this a correct way to do it? Can someone please help me. //Sprite Object this.mainBird = this.physics.add.sprite(game.config.width / 3, 150, 'YellowBird1'); //Static group this.letters = this.physics.add.staticGroup(); this.letterA = this.letters.create(400, 268, 'A'); this.letterB = this.letters.create(600, 400, 'B'); this.letterC = this.letters.create(650, 250, 'C'); this.letterD = this.letters.create(450, 220, 'D'); //Overlap code this.physics.add.overlap(this.mainBird, this.letters, this.collectLetter, null, this); //Callback Function collectLetter() { console.log("collect") } When I debug into phaser.js i found that the result in the below code is returning as blank. This is in line number 82393 in phaser.js (3.7.1) version. var results = (group.physicsType === CONST.DYNAMIC_BODY) ? :; The min and max X and Y values are not matching even though I am updating the x value of the group objects inside update function .
  10. Thank You Stupod, I am not using the debug bar. The particles emitted based on how fast the player is playing the game. If both players played fast then there is some delay in the particles.
  11. Hi All, In my game i am having a emitter which execute when user tap on the object. The emitter is slow in low level android phones. So I am planning to check the fps. If fps < 30 then don't show the emitter ELSE show the emitter. I am going to use the below line in create function so that Phaser will calculate the fps. = true; Will it reduce the performance of the game, because only when the advancedTiming property is set to true Phaser starts calculating fps, which is an additional work for Phaser. Thanks for your help. Joseph
  12. Great Its working. I am using \u*** thanks for your help!
  13. Hi all, Thanks for reading the question. I want to show a html symbol like copyright symbol using the code &copy; Is it possible to do that in Phaser. can someone please give some idea on this. thanks Joseph
  14. I couldn't find a way to fix it. I am using text sharing when its WEBGL. If anybody find any answers please shared it here. Thanks for your help.