ThatGirlDee

Members
  • Content Count

    5
  • Joined

  • Last visited

About ThatGirlDee

  • Rank
    Newbie

Profile Information

  • Gender
    Not Telling

Contact Methods

  • Twitter
    ThatGirlDee

Recent Profile Visitors

608 profile views
  1. Did you find an answer to this? I am having a similar problem.
  2. ThatGirlDee

    On

    Thanks Rich! when I console logged delay it logged Infinity, after changing this it worked.
  3. ThatGirlDee

    On

    I'm trying to set a timer to remove the onDown callback if the onDown input is enabled for a certain amount of seconds. At this stage I have a timer in the update function which should just print a word, but the timer never fires and the word is never printed. I feel like I have missed something simple but any help would be much appreciated. my timer looks like this this.game.time.events.loop(delay, this.touchOff, this); the function touchOff simply prints "TOUCH OFF" at the moment.
  4. I'm counting the current time by using Phaser.sound.currentTime to store the time the song starts and then every update setting songTime like this: this.songTime = song.currentTime - this.previousTime;this.previousTime = this.song.currentTime;when I tried to log out the songTime value every update it shows a weird loop where every other update it sets to 0 CURRENT Time: 34CURRENT Time: 0CURRENT Time: 94CURRENT Time: 0CURRENT Time: 73CURRENT Time: 0CURRENT Time: 69CURRENT Time: 0what is the difference between sound.currentTime and sound.position? Is there a more accurate way of storing the milliseconds the song is currently at or should I be using fps instead of milliseconds ? Thank you for your help! Edit: So I solved the sound not playing by setting my songTime var to only update if the song was playing and also updating the var with += rather than equals which was just resetting it to 1 every time. Rich was also right and a range comparison worked I used: if (this.songTime % storage['eighthNoteDuration'] == 0 && this.songTime == storage['notes'][i] )
  5. Hi I'm new to Javascript and trying to learn Phaser by building a simple rhythm game. in short you tap along to the beat of a song. You know when to tap by a horn sound. I have created a function that calculates when the sound should play in the given time in minutes and stores it to an array like this: function songManager(evt) { this.notes = []; storage['currentBpm'] = evt.bpm storage['eighthNoteDuration'] = 1000 * 0.5 * 60 /evt.bpm ; this.totalBars = (storage['eighthNoteDuration'] * 32) / storage['totalTime'] ; // Set global notes array for (var bar =0; bar < this.totalBars; bar ++){ //console.log(bar); var noteTime = bar * 8 * storage['eighthNoteDuration']; this.notes.push(noteTime + 2 *storage['eighthNoteDuration'], noteTime + 8 * storage['eighthNoteDuration'] ); } storage['notes'] = this.notes; function calculateBar(evt) { this.notes.push(evt ); } I'm having trouble keeping track of time in my game.js and comparing it to the time in my array. I start the song and the timer: songStart: function() { this.previousTime = this.song.currentTime; this.song.play(); this.lastReportedPlayheadPosition = 0; this.songPlaying = true; },and then update the time in the update function: this.songTime = this.song.currentTime - this.previousTime; this.previousTime = this.song.currentTime;then I check to play the horn in a function called every update also : tapActive: function() { if(this.songPlaying == true){ for ( var i =0; i < storage['notes'].length; i++){ if (this.songTime == storage['notes'][i] ) { this.horn.play(); this.input.onDown.addOnce(this.isDown,this); } else { this.input.destroy(); } } } },At the moment my horn does not play at all and the input never turns active. I know I might be asking a lot but any suggestions or a better idea of how to do this would be much appreciated. Thank You!