khleug35

Members
  • Content count

    18
  • Joined

  • Last visited

  1. thanks for reply I using ogg and mp3 ....... I try to convert this example to android apk file https://phaser.io/examples/v2/audio/play-music It also can't run the game about audio error......... when I use this code game.load.audio('boden', ['assets/audio/bodenstaendig_2000_in_rock_4bit.mp3', 'assets/audio/bodenstaendig_2000_in_rock_4bit.ogg']); but I use this code ,it is work game.load.audio('boden', ['http://examples.phaser.io/assets/audio/bodenstaendig_2000_in_rock_4bit.mp3', 'http://examples.phaser.io/assets/audio/bodenstaendig_2000_in_rock_4bit.ogg']); I find that phonegap can't play local audio...... but this audio problem just occurs on android
  2. hello ,thank you for reply. I used Adobe PhoneGap, but when I build the game to apk file and run it on android It can't play the audio , I need to use phonegap media api to instead of Phaser audio code...... and I run the game on the android platform below 5.0 versions, It is very lag................ It is run very prefect on browser and IOS,^_^ thx
  3. Hello, everyone Which software do you recommend to build the phaser game for mobile? I used Adobe phonegap build to convert the game for moblie.......but any other suggestion?? How about react native?? THX
  4. Thank you very much!!!!samme, thank you for your help!!!!!!!!! i am sorry about that i am so stupid......... ,but thank you for your help!!!!
  5. THX, samme this code is work for me !!! thx but I am sorry about that, I have an other problem now..... I want to change state on timer........... the following code is not work, did I made a mistake?? Thank you so much this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start('gameover'), this);//not work this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start, this, 'gameover');//not work this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start, 'gameover');//not work this.time.events.add(3000, this.state.start, this, ['gameover']);//not work
  6. Could I code for a function in timer.events directly?? here is my code Normally ,The following code is work for me!!!!!!! game.time.events.add(Phaser.Timer.SECOND * 4, player_kill, this); function player_kill() { player.kill(); } but Is it possible to code for a function in timer.events directly??? THX Maybe like this , but the following code is not work, did I made a mistake?? Thank you so much game.time.events.add(Phaser.Timer.SECOND * 4, player.kill(), this); //not work
  7. [Solved]How is it possible to call this function?

    Thanks you very much!!!
  8. here is my code <script> var game = new Phaser.Game(372, 635, Phaser.AUTO, 'game'); game.state.add('menu',menu); game.state.add('Level1',Level1); game.state.start('menu'); </script> //Level1.js var Level1 = { init: function() { this.play = true; <---------/*I want to call it in Enemy: function(){this.init = function()*/--> }, preload: function() { this.load.im.......... }, create: function() { this.enemy = new this.Enemy(); this.enemy.init(); }, update: function() { ........ }, Enemy: function(){ this.init = function (){ console.log(this.play); <-----------/*I want to call this.play = true, but it show undefined*/ if(this.play == true){ <-----------/*I want to call this.play = true, but it show undefined*/ dosomething..... }else{ dosomething..... } } I want to call "this.play = true; " in Enemy: function(){ this.init = function () but it is not successful......the chrome console is display show "undefined" How is it possible to call this function??? thx very much
  9. OH!!!! Thanks!!!!When i update to Phaser CE 2.8.8!!!! It worked for me!!!!! https://phaser.io/download/stable Thanks!!!!!!samme!!!!!!
  10. My code is here var game = new Phaser.Game('100%','100%', Phaser.AUTO, '', { init: init, preload: preload, create: create, update: update, }); var background; function init(){ game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; } function preload() { game.load.image('space', 'assets/images/space.png'); } function create(){ background = game.add.tileSprite(0, 0, game.world.width, game.world.height, 'space'); background.autoScroll(0, 30); game.physics.enable(background,Phaser.Physics.ARCADE); } function update(){} When I run the game first time, It was worked, I can success to load the background. but when I refresh the game, it have error message and can't run the game. it said that phaser.2.7.7.min.js:3 Phaser.Cache.getImage: Key "__default" not found in Cache. getItem @ phaser.2.7.7.min.js:3 phaser.2.7.7.min.js:3 Phaser.Cache.getImage: Key "__missing" not found in Cache. getItem @ phaser.2.7.7.min.js:3 phaser.2.7.7.min.js:3 Uncaught TypeError: Cannot read property 'base' of null so when this error is happen, I need to clear cache form chrome or go to other page then return the game, it can success to run the game. but when I refresh the game, an error occurred.Does anyone know what problem is that ?? Thanks you very much
  11. OH!!!!!!Thanks It work for me!!!!!!!!!!! Thanks!! samid737!!!!!!!!!! Thx for your link!!!! My problem is solved!!!!!!
  12. THX finally, I use addChild() to add the player sprite, like this , I make the graphics's element follow the user graphics = game.add.graphics(0, 0); game.physics.arcade.enable(graphics); graphics.beginFill(0xFF0000, 1); player.addChild(graphics.drawCircle(0, 0, 30)); but when I move the player right left, the graphics's element position will change....... the graphics's element is leave the player body, how to fix it to center, thx I think that the scale problem is make it happen the problem............. if (faceRight == true) { player.scale.x *= -1; player.anchor.x = 0.5; player.x = player.x - 10; faceRight = false; faceLeft = true; bullet_direction = 'right'; } } and player.body.velocity.x = -250; if (faceLeft == true) { player.scale.x *= -1; player.anchor.x = 0.5; faceLeft = false; faceRight = true; bullet_direction = 'left'; }
  13. I would like to create some object follow the player movement , this situation like to call game.debug.body(player); method.......... the green square follow/pin the player any idea??? THX
  14. OH!!!!!Super Many Thanks Great !!! It Work for me !!!!!!!! Thanks!! magig!!!!!!!!!! Thx for your link!!!! My problem is solved!!!!!!
  15. Thank you very much!!!!!!!!nice