• Content count

  • Joined

  • Last visited

  1. Phaser + es6

    Thanks! I will check it out!
  2. Phaser + es6

    Hello I am trying to write a game in phaser + es6 javascript. So far I have a game state in which I am making player. But in game state I have buttons to control my character. So is this correct? // gameState.js create() { this.game.physics.startSystem(Phaser.Physics.P2JS); //activate physics this.game.physics.p2.gravity.y = 1200; //realistic gravity this.game.world.setBounds(0, 0, this.game.world.width, this.game.world.height);//(x, y, width, height) this.game.physics.p2.setBoundsToWorld(true, true, false, true, false); //(left, right, top, bottom, setCollisionGroup) this.game.physics.p2.friction = 5; // default friction between ground and player or fireballs // setup our player let player = new Player(this.game, this.game.world.width/2, this.game.world.height - 150, 'player'); // create our virtual game controller buttons let buttonjump = this.game.add.button(400, 300, 'buttonjump', null, this, 0, 1, 0, 1); //game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame buttonjump.fixedToCamera = true; //our buttons should stay on the same place buttonjump.events.onInputDown.add(function(){ player.skill_1=true; }); buttonjump.events.onInputUp.add(function(){ player.skill_1=false; }); let buttonfire = this.game.add.button(500, 300, 'buttonfire', null, this, 0, 1, 0, 1); buttonfire.fixedToCamera = true; buttonfire.events.onInputDown.add(function(){ player.fire=true; }); buttonfire.events.onInputUp.add(function(){ player.fire=false; }); let buttonleft = this.game.add.button(0, 300, 'buttonhorizontal', null, this, 0, 1, 0, 1); buttonleft.fixedToCamera = true; buttonleft.events.onInputDown.add(function(){ player.moveLeft=true; }); buttonleft.events.onInputUp.add(function(){ player.moveLeft=false; }); let buttonright = this.game.add.button(160, 300, 'buttonhorizontal', null, this, 0, 1, 0, 1); buttonright.fixedToCamera = true; buttonright.events.onInputDown.add(function(){ player.moveRight=true; }); buttonright.events.onInputUp.add(function(){ player.moveRight=false; }); } //Player constructor constructor(game, x, y, key) { super(game, x, y, key); this.game.physics.p2.enable(this); this.body.setCircle(22); // collision circle this.body.fixedRotation=true; // do not rotate on collision this.body.mass = 4; // add some animations this.animations.add('idle', [0,1,2,3,4,3,2,1,0] , 10, true); // (key, framesarray, fps,repeat) this.animations.add('walk', [11,12,13,14,15,16,17,18], 15, true); // (key, framesarray, fps,repeat) this.anim = this.animations.add('skill_1', [5,6,7,8,9,10], 15, false); // (key, framesarray, fps,repeat) this.anim.onComplete.add(this.shake, this); this.game.stage.addChild(this); this.skill = false; this.skill_1 = false; this.moveLeft = false; this.moveRight = false; }
  3. Animating other players

    Hello, I am creating realtime game using node + socket.io. At the moment I'm trying to figure out how could I animate other players movements. This is how I put other players on map: socket.on('showPlayers', (data) => { for (var key in data.players) { if(key != data.id) players[key] = game.add.sprite(data.players[key].position.x, data.players[key].position.y, 'player', 1); } }); And Updating their positions: socket.on('updatePlayers', (data) => { players[data.id].position = data.position; }); To animate my own player I am simply using: // Player player = game.add.sprite(48, 48, 'player', 1); player.animations.add('left', [3,5], 5, true); player.animations.add('right', [6,8], 5, true); player.animations.add('up', [9,11], 5, true); player.animations.add('down', [0,2], 5, true); Best Regards!
  4. Flappy Pong

    Good point, I will think about it!
  5. [Phaser] Truck Reign

    How did you achive this nice effect with your logo "Alex Creativity"??
  6. [Phaser] Truck Reign

    Looks good, but the levels are a little bit too long and monotonous PS. What ads are you using?
  7. Flappy Pong

    @refresh Some advices?
  8. Flappy Pong

    Hello everyone, I'm very glad that I can show you my game called Flappy Pong. Its a little mix up of flappy bird and classic pong. In simple words - you have to bounce the ball. Everything with beautiful changing colors! Get it on play store: Click Here PS. I'm aware that at the start there may be some light freeze - its due to the loading banner from admob(Still trying to figure it out, maybe someone have some solution?). Tell me your opinions
  9. Ads in phaser game

    I use https://cocoon.io/ with simple webview. Crosswalk add extra 18mb, since my game weight is about 2mb...
  10. Ads in phaser game

    Yeah I know but my menus are all animated, thats a problem I see two options: - use webworkers(i dont know how) - or use native admob for java Some other suggestions?
  11. Ads in phaser game

    Already tried it yesterday, result the same. https://github.com/floatinghotpot/cordova-admob-pro/wiki/Known-Issues-&-Solution---Workaround There is a post about my problem but i need to find solution :/
  12. Ads in phaser game

    My problem is connected with banner, i didnt test interstitial. I was testing on xiaomi mi5, huawei p8 lite and some samsung, but always with the same effect. I cant see lags in your game, because it shows in menu without any animations It looks like something is loading with fps dropdown and after that everything is normal(almost).
  13. Ads in phaser game

    Hello! I have developed small game and I wanted monetized it. But there is a one big problem... Admob plugin(cordova) makes the game laggy at the beggining. I am looking for a solution long time, tried different plugins, the result was the same. Can anyone help me? I tried use webworkers but i couldn't fit the code to it. Thanks!
  14. Hello, recently I made a game and now is the time to fit it to all screens. game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; works well for me but only if the canvas is not in the div with id. If I have: new Phaser.Game(360,640,Phaser.CANVAS,'for example') scaling is freakin out. How can I get it working within div? Hope you can help me
  15. Hello I have a little problem I am tinting graphics and its work well, then I want to tint the bitmap text the same way so the graphics and text have the same color. And there is a problem, because it gives various results. bg1 = game.add.graphics(0,0); bg1.beginFill(0xffffff,1); bg1.drawRect(15, 15, 330, 550); bg1.tint = 0xEBEBEB; Score = game.add.bitmapText(0,0,'score','0', 120); Score.tint = 0xEBEBEB; // to this point, everything is correct, graphic and text have the same color // now in function i am changing tint in bg1 and it works bg1.tint = Phaser.Color.interpolateColor(colorData1[index-1],colorData1[index],duration,currentStep); // then I want the same for the text, but it gives different result Score.tint = bg1.tint; The font is white so as the graphics.