Hipst3rKiwi Posted May 7, 2014 Share Posted May 7, 2014 hello, i was making a flappy bird clone for school and i keep on getting this error whenever i try to make my pipe functions work Uncaught TypeError: Cannot call method 'apply' of undefined phaser.js:39346 Phaser.Timer.updatephaser.js:39346 Phaser.Time.updatephaser.js:38796 Phaser.Game.updatephaser.js:19712 Phaser.RequestAnimationFrame.updateRAFphaser.js:34769 _onLoopphaser.js:34755 code: function start() { birdSprite.body.allowGravity = true; // spawn pipes // Create our Timer pipeT = game.time.create(false); // Set a TimerEvent to occur after 2 seconds pipeT.loop(2000, pipeS, pipeS); // Start the timer pipeT.start();} function pipeS() { //pipeT.stop(); var pipeY = ((game.height - 16 - OPENING / 2) / 2) + (Math.random() > 0.5 ? -1 : 1) * Math.random() * game.height / 6; // Bottom Pipe var botPipe = makePipe(pipeY); // Top Pipe (flipped) var topPipe = makePipe(pipeY, true); // Add invisible space thingy var inv = invs.create(topPipe.x + topPipe.width, 0); inv.width = 2; inv.height = game.world.height; inv.velocity = -SPEED; //pipeT.start(); pipeT.add(1 / SPAWN_RATE);} function makePipe(pipeY, flipped) { var pipes = create( game.width, pipeY + (flipped ? -OPENING : OPENING) / 2, 'pipe' ); // Flip pipe pipe.scale.setTo(2, flipped ? -2 : 2); pipe.offset = flipped ? -pipe.body.height * 2 : 0; // Move to the left pipe.body.velocity.x = -SPEED; also for some reason im getting a problem with this return pipe;} can anyone help? Link to comment Share on other sites More sharing options...
Recommended Posts