Search the Community
Showing results for tags 'wave'.
-
Hi guys, Is possible create a water wave effect with Phaser? Exist any plugin? What do you think about to integrate with Phaser physics? Thanks in advance, Nicholls
-
I am trying to make a game similar to a game on the Play Store, called 'Sine Line'. I am not able to figure out how to keep the particle oscillating when input is not given. When input is given, the particle should travel in a sinusoidal manner. But when you release the input, it shouldn't stop. Instead, it should keep oscillating along the X axis. Any help appreciated. Thank you in advance. P.S. I am attaching the JS file. I've written it in a very messy manner. Sorry for that. game.js
- 8 replies
-
- collision
- oscillation
-
(and 5 more)
Tagged with:
-
Hi everyone, I want to add a wave movement to my bullet i use this: if (APP.player.alive === true) { if (APP.fireButton.isDown) { angle = 0; fireBullet(); } }function fireBullet() { // To avoid them being allowed to fire too fast we set a time limit if (game.time.now > APP.bulletTime) { //game.sound.play('fire'); APP.bulletTime = game.time.now + APP.bulletRate; // Grab the first bullet we can from the pool var currentBullet = APP.bullets.getFirstExists(false); if (currentBullet) { currentBullet.revive(); currentBullet.lifespan = 2000; //kill after 2000ms if (APP.facing === "right") { // And fire it currentBullet.reset(APP.player.x + 15, APP.player.y + 15); currentBullet.body.velocity.x = APP.bulletvelocity; game.time.events.repeat(25, 80, function() { currentBullet.body.velocity.y = Math.sin(angle) * 20; angle += 0.1; console.log(angle); }, this); } else if (APP.facing === "left") { currentBullet.reset(APP.player.x, APP.player.y + 15); currentBullet.body.velocity.x = -APP.bulletvelocity; currentBullet.body.velocity.y = APP.bulletY; } } }}If a fire too quickly they share the same angle. How to define a different var angle for each bullets. Thank you.