Search the Community

Showing results for tags 'duration'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 5 results

  1. Hi, If I create animation this way: myanim = scene.add.sprite('myanim'); scene.anims.create({ key: 'myanim', frames: scene.anims.generateFrameNumbers('myanim', { start: 0, end: 20 }), duration: 1000, hideOnComplete: true }); .. and later I want to change it's duration or frameRate - how to do that? I try this, but no luck: myanim.anims.duration = 3000; myanim.anims.frameRate = 15; myanim.anims.currentAnim.duration = 3000; myanim.anims.currentAnim.frameRate = 15; Animation still runs with the initiall duration.
  2. I have a situation where I need to know the duration of my sound elements before they are played. However, the duration is 0 (as well as durationMS and totalDuration). So I dug into the code and realised that duration is only set if the browser uses the audio tag, not when it uses the webaudio api (latest chrome use the latter). So what is the best way to get the duration? I have done some digging: Using the game.cache.getSound(key) you can extract information about the sound object. This object will hold a "data" property which has a "duration" property. But this is only set once the audio file has been decoded. The preload in a state does not wait for audio files to be decoded, which means that in the beginning of the create-state this data might not be available (aka when I need it to be). Have anyone battled audio duration and succeeded?
  3. Hello guys and girls, I am trying to get my head around one problem I am noticing when using Phaser's tweening mechanism. I've create a simple effect to highlight text which I wan't to be clicked on. The thing is, that the tweens (scale up and scale back) run at different speed on different machines. On table PC or laptop, the animation is shorter than on mobile devices meaning the tween takes less time to complete. Am I doing something wrong here? Is it a "feature"? I mean if I tell the framework that a tween should last 1000ms, it should last 1000ms no matter the CPU speed. FYI, I am using Phaser.AUTO for the renderer in the game constructor. BTW, I am experiencing this issue also in standard examples from examples library (like tweens > bounce). Thank you very much. this.Effects = { pulsateText: function(text, pulsDuration) { var self = { scaleUp: _game.add.tween(text), scaleBack: _game.add.tween(text) };{ fontSize: text._baseFontSize + 10 }, pulsDuration, Phaser.Easing.Linear.None, true); self.scaleUp.onStart.add(function() { self.delay = 0; }, this); self.scaleUp.chain(self.scaleBack);{ fontSize: text._baseFontSize }, pulsDuration, Phaser.Easing.Linear.None, true); self.scaleUp.onStart.add(function() { self.delay = 0; }, this); self.scaleBack.chain(self.scaleUp); self.scaleUp.start(); return self; } }
  4. Hi everyone, I want to make a basic rhythm game in Phaser where the user has to hit specified keys to 'catch' the incoming notes while staying in rythm. So far the main game area roughly looks like this: The idea is that the key must be hit (and the corresponding note played) when the note sprite fully overlaps the key sprite, and the score is calculated based of how close the note sprite is to the top edge of the key sprite. I have an array of percussion loops with various BPMs I made in a DAW which change after each level to increase the difficulty. When the level starts this function is called: beginPlaying: function(l){this.noteCount = 25;this.currentLoop = this.loops[l];;this.maxInterval = this.currentLoop.durationMS/4;this.timer.add(0, this.generateNotes, this);this.timer.start();},generateNotes function goes like this: generateNotes: function(){if(this.noteCount > 0){var num =, 4);var note = this.notes.create(this.noteFlags.getAt(num).x, - 20, 'note');;var distance = note.y - this.noteFlags.getAt(num).y;note.body.velocity.y = -(distance/(this.currentLoop.duration/2));this.noteCount--;this.timer.add(this.maxInterval, this.generateNotes, this);}},I'm planning to make it more complicated by spawning notes not only at maxInterval, but so far I'm facing a problem: even though the first few notes seem to land perfectly in rhythm with the currentLoop, later they stop keeping up with the drums and the whole thing goes completely out of sync. I suppose this has something to do with the sound duration in ms and the fact that this.maxInterval is not a whole number. I tried rounding the numbers using Math.round and Math.floor and I also tried alternative methods of calculating note positions, like n.y -= (distance/(this.currentLoop.duration/2))/60;called using this.notes.forEachAlive method from the update function. Right now I'm completely lost (I guess that's the price you pay when you start programming while not being very good at maths ). Is there any way to deal with the audio/velocity sync problem? I would very much appreciate any suggestions Thanks!
  5. Hi, Sorry if this has been answered before but I couldn't seem to find an answer. I'm using a timer to give my player a set amount of time to complete some levels. Depending on certain actions I want to be able to give the player more or less time as the clock counts down but can't seem to find out how. I'm using this code to set up my timer: this.timer =;this.timer.loop(timerSeconds * 1000, this.timeUp, this);this.timer.start();Is it possible to update this with an extra 5 seconds or 5 seconds less for example while it's counting down? Thanks.