Search the Community

Showing results for tags 'stop'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 15 results

  1. Good morning! I've a related sounds question. I would like to manage all my sounds in just one Phaser sound object, when i want to start playing one or more sounds, it all works properly but, when I have to check if one specific sound is playing, or if I want to pause/stop one specific sound I don't get how to do that. Example: let sounds: Phaser.Sound = null; sounds = game.sound.play(sound1, 1, true); sounds = game.sound.play(sound2, 1, false); sounds = game.sound.play(sound3, 1, true); sounds = game.sound.play(sound4, 1, false); Now how I can check if sound2 is playing or pause/stop just sound4?
  2. Firefox Sound issue

    Hello, I've got an issue stopping audio on Firefox. On Chrome ore Edge stopping the Sound works fine but Firefox won't stop the sound and if you start the Sound again it'll play twice. The main intention was to stop the sound when the state shuts down but it doesn't work when I bind the command to a key aswell. It's really annoying and I couldn't find a fix anywhere. I start the sound in the Create function with music = game.add.audio('background_music'); music.play(); music.loopFull(0.3); music.volume = 0.3; and try to stop it in the Shutdown function with "music.stop();" You can also try it yourself HERE
  3. I'm still new to Phaser and coding in general so I apologize if this doesn't make sense. I have player gravity and bounce set to 0 and movement velocity cranked up so movement seems instant. I'm looking to make it so that once the player hits a certain point on the x axis it stops, then the movement key must be pressed again to continue in either direction until it hits another one of those points, and so on. One idea I had was to populate the screen with vertical immovable bars with collision spread out evenly, but I don't know how to make it so that once the player hits them and stops their momentum they can then proceed through them at the press of the movement key (or if thats even possible). I feel like its more likely that I'd be able to set a coordinate for movement to stop, but again I don't know if thats possible either. Any help would be appreciated!
  4. possible to stop a tween ?

    hi, i'm searching to use the delay of a tween and also have the possibility to cancel this tween. But that don't work, the tween is still here and the lock function works... have you an idea ? this.tween=game.add.tween(background.cursor_player.scale).to({x:3},850,Phaser.Easing.Bounce.In,true,0) this.tween.onComplete.add(this.lock,this) this.lock=function(){ } game.time.events.add(100,this.tween(stop),this)
  5. BUG catching video stop

    Hi, I'm having a problem (it looks like a bug) with phaser.signal detecting when a video has ended when using changeSource function. I'm using phaser 2.4.8 (but it also happened with 2.4.6). To reproduce the issue, please change both videos and the image button with some media you have. Once you run the demo, check your developer console each time button is pressed. The first time the video is stopped, it says "Played 1 times" The second time it says "Played 2 times" AND "Played 3 times" The third time it says "Played 4 times", "Played 5 times" AND "Played 6 times" and so on... It's like it is reporting when each video has stopped, not just the video that has just been "source changed". Here's the code: window.played = 0; var game = new Phaser.Game(1280, 720, Phaser.AUTO, 'gameCanvas', { preload: preload, create: create}); function preload() { game.load.video('Blank', 'vids/blank.mp4'); game.load.image('btn','gfx/btn_conoce.png'); } function create() { button = game.add.button(100, 400, 'btn', btnClick); video = game.add.video('Blank'); video.addToWorld(0, 0, 0, 0, 0, 0); videoOnStop = new Phaser.Signal(); video.onComplete = videoOnStop; game.world.bringToTop(button); videoOnStop.add(function() { played++; console.log("Video Stopped: Played " + played + " times"); }); } function btnClick() { video.changeSource('vids/anothervideo.mp4'); video.play(false); } Greets!
  6. Hi there, I'm back Is there a way to detect if a mesh has animations playing and cancel them? I'm using the following code to animate the emissive color of my meshes on mouse over, but it doesn't seem to be pushing the animation to mesh.animations: BABYLON.Animation.CreateAndStartAnimation('fadingIn', objectUnderPointer, "material.emissiveColor", 30, 10, objectUnderPointer.material.emissiveColor, fullEmissive, 0); Also the Animation class doesn't seem to have a stop method so I'm not sure where to go from there. Thanks!
  7. Hi! I'm new to this so this is probably a dumb question.. Been trying to make a game where object moves through labyrinth without going through walls. I implemented collision detection to the point where I'm sure its working but when I tried to move it with .position method there was no collision happening so I ended up using the moveWithCollisions method. This works but once you press the button the object starts moving and doesn't ever stop it just changes direction at another key press. It also increases speed and both of this thing make it very useful to move it through gaps in the walls and navigate it.. So is there a way to control speed and stop mesh before there is a collision/intersection? Or is there a whole different better way to implement movement of that kind? Any advice, opinion and info welcome and thanks so much This is how code for one key press looks like: (sphere is the object we're trying to move - i have yet to import it but at least I know how to do that) window.addEventListener("keydown", function(evt) { if (evt.keyCode==87){//forward scene.registerBeforeRender(function () { sphere.computeWorldMatrix(true); //labyrinth.computeWorldMatrix(true); if (!sphere.intersectsMesh(labyrinth, true)) { //sphere.applyImpulse(new BABYLON.Vector3(premikanjeX, 0, premikanjeZ), sphere.position); var forward = new BABYLON.Vector3(parseFloat(Math.sin(parseFloat(sphere.rotation.y))) / 8, 0, parseFloat(Math.cos(parseFloat(sphere.rotation.y))) / 8); sphere.moveWithCollisions(forward); } });}}, false);
  8. stop dragging

    Hello, I need to if item.x equal 100 then items cannot be drag. I added : currentsprite.events.onDragStop.add(mouseDragEnd, this); function mouseDragEnd(item, pointer) { if(item.x == 100) item.stopDrag(); } But there is not working. Did anyone help me = ) ? Thanks. Alper
  9. Hello, I was wondering how can I immediately stop a tween from keep updating once the associated object is killed or removed. Is there an official way to do this? I know I could keep a reference of the tween in an array or variable but I have over 20 tweens simultaneously updating and I wouldn't want to keep iterating an array just to find one tween in order to stop it. Thanks!
  10. Problem with Tweens

    Hello again! I was trying to use a lot of tweens in some scenes of my game, and I wasn't able to find a way to stop the tweens. I've tried to set a flag to false to stop it from ending, But I found out the hard way that they wasn't actually stopping. When I started another tween, my object's coordinates were messed up because of the previous interruption of tweens. Is there a way to stop a tween in a way that it REALLY stops? I'd be very grateful if someone could answer this to me. (PS.: I've already found three other posts about it, but their solution (myTween.stop() doesn't work anymore, it seems) Thanks!
  11. I would like it so that when a certain event happens, the player completely stops moving (for a few seconds or so), the user does not have the ability to move at all, and I am then able to proceed to call a function (which calls a function to end the game). How would I implement this? Here is a snippet of code located in my Update function: (Please note: I am using the Phaser basic template, so when calling functions and methods, we must use 'this'. if (this.game.physics.collide(player, certainItem)) { var hit = this.game.add.audio('hit'); hit.play(); certainItem.kill(); player.body.velocity.x = 0; // Tried to stop, but I am still able to move him player.animations.play('hit'); // Changes to the frame I wanted but then quick //-ly changes back // this.gameOver(); }Thank you in advance.
  12. Hello everyone, I started using Phaser today and I must say I am impressed. Well done guys! I made a simple image rotate and move towards the mouse, as explained in the examples "accelerate to pointer" and "move towards object". What happens though is that when that image collides with the mouse (meaning image coordinates = mouse coordinates) the image stops and starts trembling awkwardly. Any way to make it stop facing the last position before colliding? My code: var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload() { game.load.image('player', 'assets/player.png');}function create() { player = game.add.sprite(400, 300, 'player'); player.anchor.setTo(0.5, 0.5);}function update() { if (game.physics.collide(player, this.game.input.activePointer.circle)) { player.velocity.x = 0; player.velocity.y = 0; } else { player.rotation = game.physics.moveToPointer(player, 60, this.game.input.activePointer); }}Thanks!
  13. I'm going to build a cool animated game, simple mechanics and few game objects (around limit of 50) without counting particle effects if any. The main goal a want to succeed is to make smooth animation. All animation is going to be sprite/frame based, and still a lot of games use 3 to 4 frames for animating a character running left, or top My main question is when frames are too many... If i make 10 frame for walking left, 10 frame for walking to top, then 10 frames for walking to bottom, and 10 frame for a idle animation: Then I've got to have 40 frames of character for the most basic animations. Then lets consider: jump, duck, slide, lean and so on.... Also should I consider making a transitional frames from: jump to duck for example: When player jumps, and the land he isn't landing straight to idle animation, but is a bit crouching then - if player press: "duck" instead of finishing the animation to stand up, and then make the player duck, i want to stop the animation on the 7 frame of jump animation and start playing jump-crouch to duck animation... Because this is a wide description I'll search and throw some examples from the web which I rate as good spite animations... but also I''ll be vary happy if more people share their vision for in game animations, or some article they find useful... I'll update the topic with my own research too Ahh also very important detail: A character for my future game will have a average size ot 200 x 200 px - so I think this makes the need of more frames to make animation more smooth since if a characters is 50 x 50 px - art. then you can't make so many diferent body positions and so on.
  14. Stop Update?

    Hello all, I am trying to basically stop my Phaser game completely, the main thing is getting it to stop "updating". I'm not sure how to do this. This is my code creating the game: game = new Phaser.Game(1000, 600, Phaser.AUTO, "gameCanv", { preload: preload, create: create, update: update, quitGame: quitGame } ); In the quitGame function, I am trying to stop the game from running, so I can see if the user got a high score, update the scoreboard for it, and ask the user if they want to play again with different conditions. I have this code for that function: function quitGame(){ console.log("in quitGame"); ingredient.kill(); chef.kill(); score = 0; gameOverOne();} //end quitGame function Please help... Thank you!