Search the Community
Showing results for tags 'bpm'.
-
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.currentLoop.play();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 = this.game.rnd.integerInRange(0, 4);var note = this.notes.create(this.noteFlags.getAt(num).x, this.game.height - 20, 'note');this.game.physics.arcade.enable(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!
-
Hello from Bideo Wego! http://bideowego.com I wanted to post about a music/rhythm based game I just uploaded on Kongregate. http://www.kongregate.com/games/BideoWego/mo-ritmo Feel free to check out the promo too What I specifically wanted to open for discussion is the strategy used to program the game. I used a helper program. The helper program was created in Flex 4. It is used to create the level data for the game. Basically it provides a simple button interface in which I can click buttons that correspond to specific arrows being dropped at specific times (channel positions) in the As3 sound. It does this all by calculations according to the sound length and bpm which I provide. An XML is generated that my game then can download from my server dynamically and read into a playable level! This XML is savable and reloadable into the same program to allow for editing as well. I would really like to create a version of this game with Phaser for HTML 5 and possible later a version for iOS and Android with Cocos2d. I wonder if anyone has done anything similar to this kind of project and has implemented a 'hold' feature in their rhythm game. In case anyone is wondering, this would mean that instead of striking and releasing keys/beats directly, the user would have to hold one or more keys until the end of a certain length (note duration) and then receive points or lose points based on the accuracy of that. This is another feature I'd like subsequent versions of the game to have, so if anyone is interested in talking about the coding strategy for that, it would be awesome! Like I said if anyone wants to discuss how this is done, as it pertains to the music I figured this is the place to do it! Or feel free to just try out the game and tell me what you think! Bideo Wego