• Content count

  • Joined

  • Last visited

About FakeWizard

  • Rank
    Advanced Member
  • Birthday 04/07/1985

Profile Information

  • Gender
  • Location
  1. Your code will always be accessible to the client, neither obsfucating nor uglifying prevents users from altering/tampering with your code. The uglifying in fact, only slows down the process of understanding your code. Therefore instead of spending too much time on encrypting the code on client side, you should work on the backend code to ensure the data form client are accurate.
  2. what can yoiu see in your console? any errors?
  3. same here
  4. have you tried defining this.input.maxPointers = 1; in your game boot state? Ahh never mind..just realised it's not related to Phaser...sigh
  5. same here, unable to switch to fullscreen on my Huawei Honor 8, Android version 7.0, Chrome v.57.0.2987.132.
  6. the js file where you have the function B defined has to be loaded before the other file where you;re using it. /// fileA.js function A (){ game.add.sprite = sprite1(some.x, some.y) B(); } /// fileB.js function B (){ game.add.sprite= sprite2(sprite1.x, sprite1.y); } So in your index.html file you just do <script src="fileB.js"> </script> <srcipt src="fileA.js"> </script>
  7. it's very easy to cheat in this game..you put too much trust on client-side ;] .. Sorry for trolling the players (or AI ).. was able to shoot like 100 bullets at once :] But apart from that it's really nice game, works pretty well :]
  8. It's because you're passing the methods in an object, in such cases these methods will always refer to it's parent object. Which in this case is Phaser.Game. And this.MyColor variable doesn't exist there. let preload = function(){ console.log( this ) //// points to Phaser.Game } var game = new Phaser.Game(1200, 600, Phaser.AUTO, 'content', { preload: preload }) I'd recommend using ES6 way of extending Phaser classes , it's less confusing IMHO. class BootState extends Phaser.State { init(){ this.myColor = Phaser.Color.createColor(255,255,0); } preload(){ this.game.load.image("platform", "star.png"); } create() { console.log(this.myColor); } } class SimpleGame extends Phaser.Game { constructor() { super(1200, 600, Phaser.AUTO, 'content' ); } init(){ this.state.add("boot", BootState ); this.state.start('boot'); } } window.onload = () => { var game = new SimpleGame().init(); };
  9. I know that there is a separate method Sprite.resetFrame() which resets the texture's frame to default. But I just though it may be easier if it was all done implicitly while calling the Sprite.reset() method. So I'd just add another optional parameter to the reset method, and then based on this parameter call or not call the resetFrame method. reset( x: number, y: number, health?: number, resetFrame: boolean ): Phaser.Sprite;
  10. the code seems ok, can you see any errors in your browser's console? Are you testing this purely in your browser or from a http server?
  11. you have to define the functions (create, update, reload ..) inside thier appropriate js file and load them before the game.js... No need to define the functions in game.js otherwise you'll overwritte them.
  12. It's pure guess, but I think, it could be cause you're adding an existing instance of object which is currently being initialized. Perhaps changing the order a little bit may help here. class Player extends Phaser.Sprite { constructor(game, x, y) { super(game); this.playerBody = this.addChild( game.add.sprite( x, y, 'atlas1', 'dot' ) ); this.playerBody.anchor.set(0.5); this.inputEnabled = true; this.input.enableDrag(); this.enableBody = true; this.game.physics.enable(this, Phaser.Physics.ARCADE); game.world.add( this ); } } Also not really sure what are you trying to do here.. is the little box your hit box? Also are you sure you want to position this box on the same position as Player? Cause now Player will be placed at 0,0 position and the 'dot' will be spawned at the x,y (pre-defined) coordinates.
  13. I don't see anything dancing there, can you be more specific? Although I've simplified your animation loop by a little bit. https://jsfiddle.net/7dv61c63/3/
  14. pixi.js

    not sure why but the snake blips every time I press a cursor key. Apart form that game looks good
  15. With regards to handling events, Phaser its-self is also using Phaser.Signal to trigger specific kind of events. So from my point of view, it's definitely doable in either React or Phaser. With Phaser however, you application may feel morel like a real game, where in the other case it may fell like a simple web-page with animated text.