divers

Members
  • Content Count

    26
  • Joined

  • Last visited

About divers

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. So I figured it on my own, here's what I did to detect current tween: if (this.movement && this.movement.isPlaying()) { const progress = this.movement.elapsed; const currentTweenIndex = this.movement.data.findIndex(tween => { return (tween.calculatedOffset + tween.duration) > progress; }); const currentTween = this.movement.data[currentTweenIndex]; if (currentTween) { currentTween.setCallback('onComplete', () => { this.movement.destroy(); this.findPath(toX, toY); }, []); } } where this.movement is current timeline. Have a good day!
  2. Is there any event I could use to detect change between tweens in timeline?
  3. Hi guys. I have a little problem with tweens timeline. I made a demo with my problem: http://zabka229.ct8.pl/ Just click a couple of times where you want to go really fast. Sometimes character is getting extra speed and if you click the same spot multiple times the character stops. moveCharacter(path) { if (this.movement && this.movement.isPlaying()) { this.movement.destroy(); } const tweens = []; for (let i = 0; i < path.length - 1; i++) { const ex = path[i + 1].x; const ey = path[i + 1].y; tweens.push({ targets: this.player, x: { value: ex * this.map.tileWidth, duration: 200 }, y: { value: ey * this.map.tileHeight, duration: 200 } }); } this.movement = this.tweens.timeline({ tweens: tweens }); } I think that I should wait for finishing first tween in old timeline and then create new one, but I know how to check which tween is currently playing. Anyone have idea?
  4. Hello everyone, recently I started creating browser based game in HTML5. I am wondering if I can use popular footballers images in it without some sort of problems. Screen for example: https://s11.footballteam.pl/images/index/ft2.jpg
  5. divers

    Phaser + es6

    Thanks! I will check it out!
  6. divers

    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; }
  7. 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!
  8. divers

    Flappy Pong

    Good point, I will think about it!
  9. How did you achive this nice effect with your logo "Alex Creativity"??
  10. Looks good, but the levels are a little bit too long and monotonous PS. What ads are you using?
  11. divers

    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
  12. divers

    Ads in phaser game

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

    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?
  14. divers

    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 :/