scofieldly

Members
  • Content Count

    28
  • Joined

  • Last visited

Everything posted by scofieldly

  1. hi guys, is there any way to calculate the sprite's actual position in the dom layer, I want to make an input text to follow a phaser sprite in the canvas, thanks.
  2. hi all, I have a problem about the p2 body and sprite positon when I enable a p2 body to a sprite, I use fish.body.setRectangle(fish.width, fish.height); to set the body shape, but the position of body is far away from the sprite, anyone know what is the problem? thx
  3. thx for reply, actually I don't want to load assets in the end of stateA, I want to load during the stateA, is that possible? I think there should be some way to do it. but the loading always be reset
  4. Hi all, currently I got 2 state stateA assetsA stateB assetsB I want to load assetsB after stateA create completed, so when I go to stateB the preload flow can be faster even to 0. so I wrote like this in the end of stateA create part but I got some wranings this.game.load.audio('stateB1', 'assets/audio/stateB1.ogg'); this.game.load.start(); Phaser.Loader - active loading canceled / reset ----phaser-2.6.2.js:74076 and the assets are not loaded at all. so do you guys now how should I do to 【preload】assets for next state, thx
  5. thx for your reply, just actually I just follow rich's tutorial, anyway I will try your recommend pluin thx.
  6. Hi all, currently I'm read master RICH's tutorial for improve performance by batch texture. when I use the firefox dev tools canvas capture in the article https://phaser.io/tutorials/advanced-rendering-tutorial/part5 it works when I use canvas renderer, but when I change to webgl, it can not capture the analysis. FF shows error and break the app. TypeError: methodSignatureEnums is not a function-----------------call-watcher.js:168:34 I tried many version of FF and phaser. none of them can work. is there anyone tried this before and works. please give me a workable FF version, many thanks
  7. Hi all, Currently I try to rotate the game 90 degree to meet the portrait mode for my [landscape] game, I used other's solution to rotate all display object by this.game.scale.setGameSize(, ; and Phaser.World.prototype.displayObjectUpdateTransform = function() { if(!this.game.scale.correct) { this.x = this.game.camera.y + this.game.width; this.y = -this.game.camera.x; this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(90)); } else { this.x = -this.game.camera.x; this.y = -this.game.camera.y; this.rotation = 0; } PIXI.DisplayObject.prototype.updateTransform.call(this); }; now all display object are rotated, but the pointer are not rotate, so when I want to do something with activePointer like: calculation with the mouse position drag and drop logic the x, y are reversed. So I want to know is there any good solution to switch the x, y of the pointer, thx.
  8. hi everyone, Here is the problem I meet, I have a sprite and I can drag it in the right way when game has normal scale but when I change scale by game.world.scale.setTo(2); things become different. the sprite moving distance become twice as my cursor moving distance, when the scale becomes 3 the distance also become triple as well. so do you gays have any good ideas for sync cursor and sprite position, many thx.
  9. ok, I see, so do you know is there any method can provide me the REAL fps data (like: if the desitedFps = 30, the display fps should not higher than this number), thanks
  10. Hi all, I want to use p2 onbegincontact to detect 2 p2 body overlap and want to do some actions, I tried to write like this body1.onBeginContact.add(func, this); but it seems when it overlap another body, the callback func did not run. is there any tips for using this event, thanks.
  11. thx for reply, buy after I set the desiredFps to 30, game.time.fps still shows 60, do you meet the situation?
  12. Hi all, I want to ask how to limit the fps, I tried set this.game.time.fpsMax = 30, but it does not work at all and I tried to set desiredFps to 20, and I can saw the animations become slower(it should be worked) but when I display the fps value, it still display 50-60 although I set desiredFps and it seems work so anyone know how to set the max fps value and make the display fps value also be the actual value, thanks
  13. Hi all, currently I got problem that I have a websocket thread to communicate with the server. and the game object is also start in the process, the situation is like this. when I got the response: A from the server, I will change the game to a new state by game.state.start('NEW STATE'); and then I will get the response: B, C from server, then I need to run some functions defined in the new state, like this game.state.callbackContext.function_in_new_state(); but it is not working, then I loged the state game.state.current I found that the current state is still the OLD ONE. I know the state change need some time, BUT is PHASER provide any callback method when the current state changed to another one, thx everyone.
  14. hi all, currently I got a question about new Game() constructor as the define, the width and height are pixels. e.g. The width of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage width of the parent container, or the browser window if no parent is given. but when I use iphone 5s (1136 pixel width, 568 pt width) to create a 640 width game, it can not display fully, it looks that only 568 display in the screen. so I want to know how to understand this situation, thanks.
  15. hi squilibob, I meet the same problem, and I add the endFill after the draw, but it does not work. is that line make the mask work in your case? here is my code var mask = this.game.add.graphics(0, 0); mask.beginFill(0xffffff); mask.drawRect(this.popup.position.x - 530 / 2, this.popup.position.y - 150 / 2, 530, 150); // mask.drawRect(this.popup.position.x, this.popup.position.y, 530, 150); mask.anchor.set(0.5, 0.5); mask.endFill(); return mask;
  16. yes, the CDN is bad, so this situation will appear.
  17. yes, currently I am make a timer in the onfilestart event, after 2 seconds, if it not complete, I will try to load the local one. but it looks like that the CDN request did not stop or cancel.
  18. Hi all, I want to ask that is there any way to operate the loading file. what I want to do is when the file loading or waiting for the response more than 5 sec, I will stop this loading process and start a new loading from another url. I tried to customize the addToFileList function in the loader to replace the file in the Loader._fileList. but it seems the xhr loading request is still on-going. So, I wonder that can I just mark this loading as error to trigger the onError event in the loader, and stop the xhr request for this file. thx
  19. thanks for your reply rich, yes, this CDN has some chance for have a big delay, currently I find the function onFileStart in the loader, so I think I can use it to do the 'timer', logic, bug actually I want to ask is there any way that I can stop a file loading process, thanks.
  20. Hi guys, I am using phaser to dev a game, currently I got a problem that, I want to deploy my assets resource on a cdn, so I need to make a resource loader for these assets. the basic logic is that firstly I will start fetch the resource from cdn, after serval seconds, if I can not get the resource, I will switch the way to get the assets from local. for the phaser, I do not know how to check if game.load.image/ game.load.atlasJSONHash can get the corresponding resource. so is there anyone have idea how should I handle this, thx.
  21. Hi guys, I want to make a sprite pool for make bullet in the game, when I kill the bullet sprite, I found the update function is still running, so I wonder is there any way to stop the update function, actually I want to make a new update function when I get it from the pool. thanks.
  22. actually I have 2 groups, bullet and ememy, when the bullet hit ememy, I just want to make damageEffect but not collide, and the bullet will rotate when collide the bound with angle, that's why I choose p2 not arcade.
  23. hi guys, I wonder is there any way to check whether 2 sprite in different groups are overlap, in the p2 system, currently I am using game.physics.p2.setPostBroadphaseCallback(this.checkOverlap, this); to do it, however I think it maybe expensive because I need to check whether the 2 sprites are from same group (the same group should not do anything). and I do not need collide when 2 sprite impact, I just need them to trigger my function. so I wonder is there any way to do thing like body.collide in arcade system, thanks.