Jump to content

Search the Community

Showing results for tags 'pause'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

  1. I tried to change animation from GUI_Object when game paused, but the result : 1. object's animation not changed. 2. object's animation changed after the game resumed. so, How to change animation when game paused?
  2. tl;dr Pause, sleep, resume and wake make for a confusing api initially. Also a master pause (logic and audio) would be handy ( I might have missed this though.) After a longish break of game dev I wanted to take a look at Phaser 3. Loving it so far, (Phaser has come such a long way) but I find the pausing/resuming the entire game(logic, animation, sounds) a little confusing. I'm making a master Pause/Play switch. After game.loop.pause() didn't have the desired effect I've switched to game.loop.sleep and awake(). But I'm unsure if this is the intended use for them. Looking forward to the release of this bad boy, continue doing awesome work. Cheers
  3. Hi everyone i'm new guy in here.. I have a problem.. I'm playing a video with videoTexture but i want to make when i clicked to videoTexture to pause video.. I followed this topic: http://www.babylonjs-playground.com/#CHQ4T#5 everyting well but when I click anywhere on the scene video stoping Here is my code var videomat = new BABYLON.StandardMaterial("Videomat", scene); var videoTexture = new BABYLON.VideoTexture("video", ["video/vexpovid.mp4", "video/vexpovid.webm"], scene, true,true); var videobox = BABYLON.MeshBuilder.CreateBox('videobox', optionsVideo, scene); videobox.position.x = -120; videobox.position.y = 300; videobox.position.z = 163; videobox.rotation.y =3.15; videobox.material = videomat; videomat.diffuseTexture = videoTexture; videobox.material = videomat; scene.onPointerDown = function () { //videoTexture.video.play(); if (videoTexture.video.paused){ videoTexture.video.play(); } else { videoTexture.video.pause();}
  4. Hi guys – just discovered Phaser yesterday. Just wondering if anyone has an example of a pause screen/state in a game created? Would be great to see some code. Had a look at the examples in the docs and couldn't see anything. Also, is the only way to pause/resume a game to individually pause and then resume all the moving / relevant elements, or am I missing some amazing game.pause() function? I pretty familiar with JS, but am pretty much a noob at creating games with frameworks. Many thanks, Shaun
  5. hi, the background music of my application is still playing when i leave the application. the back button stop the music (left button) but not the home button (middle button) here is the code of my background music : music=game.add.audio('music'); music.volume=0.4 music.play(); i try different approach but nothing works : //approach 1 // in index.html document.addEventListener("pause",onPause,false) function onPause(){ music.pause(); }; // => don't works //approach 2 //in main.js function update(){ if(game.stage.disableVisibilityChange){ music.pause() } }; // => don't works what must i add to avoid this ? thanks for your assistance.
  6. Please bear with me, this is very likely going to be a long post. In my quest to implement a pause system with an active ui I found myself investigating input/Pointer.js. Here I discovered the reason that my Buttons were useless when the game was paused. Specifically: input/Pointer.js if (this.game.paused){ return this;}My first, and simplest fix for my use case, was simply to comment out all of the above lines. This allows me to still process Pointer callbacks when the game is paused. In my case, the UI is already set up using callbacks, but the rest of the game uses polling. So it was a convenient way to allow UI interaction without allowing other in game actions. Offhand this method seems to have some limitations. If you're implementing first person controls your character might still spin around while you interact with the UI, though I haven't looked into it. Also if you use Pointer callbacks on any objects you want to actually pause that can cause issues. After some more thought I came up with the following solutions: First: input/Pointer.js while (i-- && !this.game.paused){ this.game.input.moveCallbacks[i].callback.call(this.game.input.moveCallbacks[i].context, this, this.x, this.y, fromClick);}All I did was add a check if the game was paused before running any moveCallbacks. Correct me if I'm wrong, but I believe this would solve the issues with a first person style camera. Honestly though I'm not sure what all uses there are for moveCallbacks so some examples for context would be nice. Next: input/Pointer.js else if (!this.game.paused || (this.game.paused && candidateTarget.sprite.nopause && candidateTarget.sprite.nopause == true))This allows you to set a nopause member on any sprite. This allows you to specify exactly which objects you want to respond while the game is paused. I went ahead and added a nopause member to the sprite constructor as follows: gameobjects/Sprite.js this.nopause = false;Then I can clean up the checks from before: input/Pointer.js else if (!this.game.paused || (this.game.paused && candidateTarget.sprite.nopause == true))What do you guys think?
  7. I want to run myPixi.ticker.stop() when the window loses focus in any way, eg minimize, click a different tab or even closing the window. Q: Is there a javascript event that covers all the possibilities? Q2: Is there a javascript event that covers all possible methods of a window regaining focus, eg a return from minimize, reclicking the tab etc?
  8. How would pause ALL playing sounds... I am trying to make a pause (start/stop) functionality especially for in-game menu... Since i control the render loop and is NON-Anoymous function so can easy stop using the function that was started with... Works great but i need to PAUSE the sound too... How???
  9. here I found example: https://phaser.io/examples/v2/misc/pause-menu but there sholud use game.input.onDown.add (this is little uncomfortable, there should to plot the field x y buttons positions...), I noticed that it depends on the game.paused - if game.paused=true; these any buttons not warking correctly... If I would like use clissic buttons - game.add.button(positionx, positiony, 'button', function(){ }); I must used other idea to paused? I would like to create a more interactive menu (sliders, hover animations, cursor pointer), it is recommended that other solutions to this prolblem? Or maybe better create this menu in html/css? how to do it correct? Thanks for answer
  10. Hi everyone, i was trying to pause a scene when the browser window is not active(eg. user switches tab, ctrl/cmd+tab, another window is currently focus,etc). To pause the scene, i need the background music and all animations to be paused, below playground example shows my approach: http://babylonjs-playground.com/#1MZCTQ I got two results: 1. when I click on another window(for example a notepad) that overlapped the browser, the notepad is now focus and the browser is blur, hence both sound and animation are paused, this is expected; 2. when I ctrl/cmd+tab or manually click on another tab to switch tab, only sound is paused but the animation continues playing. looks like $(window).blur(function() {...}); is triggered, but only bgm.pause() work, anim.pause() doesn't work. $(window).focus(function() { anim.restart(); bgm.play(); }); $(window).blur(function() { anim.pause(); bgm.pause(); }); any help will be appreciated, thank you!
  11. So I have 2 animations that both work independently. I can pause and unpause either of them fine but I can't pause one, play the other and then unpause the first. This doesn't and no animations play in the end Any ideas?
  12. Can anyone help me on creating a button that is active even if the game is on pause (game.paused = true;)?
  13. Hi, I'm really new to phaser and having some issues with my game on which I created a script that when the player clicks or goes outside of the game (e.g. clicks another tab), the music should be paused and when it resumes (user clicks back in game), music should continue. The issue is that when the game continues, it music starts over the very beginning. I've followed some of the examples that I've found here but still does not work. Anyone experiencing the same thing or it's juts with my implementation? var introState = function(game){ }; introState.prototype = { preload: function(){ game.load.audio('intro', '../music/intro.mp3'); }, create: function(){ recording = game.add.audio('intro'); recording.play(); game.onPause.add(pauseMusic, this); game.onResume.add(resumeMusic, this); }, render: function(){ } } function pauseMusic() { recording.pause(); } function resumeMusic() { recording.resume(); } This is just one of a state with in my game. Any help is appreciated. Thanks
  14. scriptkid

    Pause Button

    I am creating an HTML, JS ,CSS game for android. Can someone write an example for a pause button. PS:I have a timer and it need to be stoped when button is presst.
  15. Hi! In my game you can play with a keyboard and a gamepad. With keyboard I can pause the game and execute other actions, for example can I unpause the game. However with the gamepad the player can pause the game but can not execute actions buttons gamepad with the game on pause. //pause this.actionControls.pauseKey.onDown.add(utils.pauseMenu, this); this.actionControls.pausePad.onDown.add(utils.pauseMenu, this); //utils.pauseMenu unpause the game if the game on pause Any help? A greeting!
  16. I wrote a simple function to pause rendering. window.addEventListener('blur',function(){ _ENGINE.stopRenderLoop() console.log('paused'); }); window.addEventListener('focus',function(){ _ENGINE.runRenderLoop(function(){ _SCENE.render(); }) console.log('resumed') }); When the playground code is running, i tried to pause the game by clicking the outside elements of my web browser (you can click on the console log, or the URL tab to activate the pause). The funny thing is, when I click on the scene to resume the rendering, the cube has already travelled a lot. It's as it the computations for the cube (its animations) wasn't paused. Playground link: http://www.babylonjs-playground.com/#14EGUT#23 Any ideas?
  17. I have on an extended Phaser.Game class the following let game = this; game.onGameStart = Phaser.Signal(); function startGame(){ game.onGameStart.dispatch(); } in an extended Phaser.State class I have the following create(){ let game = this.game; game.onGameStart.add(this.start, this); game.message.on('message', function(){ game.startGame(); } // message is a node server web socket remote trigger response game.paused = true; } function start() { this.game.paused = false; } When game.startGame() gets called start its called but the game._paused and game._codePaused is still set to true. WHY is this?
  18. I am currently working a a dialogue system, using DOM and Jquery to have a bit more flexibility. In short, I have an issue where I need to click two times my "close" button for the dialogue to disappear (the first one reloads the pause screen). Not sure if the problem comes from the way Phaser handles pause, an issue with Jquery, or just the way I wrote my code. A simplified version of the code would look like this: Darkness.GameState = { create: function() { ... }, update: function() { ... }, interactNpc: function(player, npc) { if (this.isActionPressed && BasicGame.gamePaused == false) { BasicGame.gamePaused = true; var game = this.game; game.paused = true; $('#dialogues').one('click', '#close-dialogue', function() { BasicGame.gamePaused = false; game.paused = false; }); } }, }; The this.isActionPressed bit is set to true or false in the update function. InteractNpc is triggered when the player overlaps a npc and presses the action key. I wonder if my var game = this.game; is not the culprit, but I don't know how to access the game object from inside the click function in another way...
  19. (Edit): Short version: As simple as the title sounds. How can you pause an animation and then resume it from that same frame? Long version: I am completely stumped with something I thought would be very simple. I have an animation that plays. When an event occurs (I don't know when it will happen ahead of time), the animation needs to pause on its current frame. Then, I need to be able to resume the animation from that frame. I have searched all around and can't seem to find a simple solution to this. Here's what I want to do (but this doesn't work): var player = game.add.spritesheet('hero', 'hero.png', 32, 32);player.animations.add('run', [0,1,2,3], 12, true);player.animations.play('run');// pause animation for a momentfunction freeze() { player.animations.currentAnim.pause(); game.time.events.add(500, function(){ player.animations.currentAnim.resume(); }, game);}Things I have already tried: Using stop() and play() - this just starts the animation from the beginningSetting currentAnim.paused = true - doesn't seem to have any effectUsing setFrame() and play() together - just plays from the beginning Any help would be greatly appreciated!
  20. I would like to start my game in a paused state with simple instructions on the screen, such as "Arrow keys to navigate, Space bar to shoot". Once the user hits one of these keys, the text would disappear and the game would start. I'm clear on showing and hiding the text. Is there a simple technique for pausing the start of the game? Most of the examples I'm finding online are more involved than what I'm looking for.
  21. Hi, We are in the process of making an "app" version of the game via Cordova and I'm struggling to fix an issue in relation to the game pausing on iOS. We provide a link to an external webpage to allow the player to register for the game and this is opened via: window.open(url '_system'); return false;If I call game.paused = true before window.open, nothing happens and the game continues.If I call game.paused = true after window.open, the link opens but I receive a gpus_ReturnNotPermittedKillClient error and crash. The thing is, this doesn't get called because the window starts opening there and then. I tried to circumvent this by putting the window.open call in a setTimeout function (delayed by 1 second) but I get the same result. I am using 2.4.2 so the game.lockRender property should also be set to true but the same issue happens. If I try to do it directly the same results. Moreover, I've added a game.onPause signal receiver in the state this happens in but this never gets called. Which makes me believe that whatever should be happening as a result of game.paused isn't actually happening. Any ideas on how I can resolve this?
  22. Just hoping there was a simple way to pause the arcade physics system for when I go into a pause menu... I don't see any property, method or "easy way" in the docs. If this doesn't exist, then what is the right way? Thanks
  23. Hi I'm trying to find a reliable way to calculate the time the game is being played and isn't paused. My scenario is that I want to show a "time left" counter on screen but I found out that game.time.now isn't reliable as it's counting even if game.paused is true. thanks
  24. I have the following code in the Boot.js init: function () { this.game.onPause.add(this.onGamePause, this); this.game.onResume.add(this.onGameResume, this);},onGamePause: function() { console.log('onGamePause'); if (!MainGame.supportAudio) return; game.sound.mute = true;},onGameResume: function() { console.log('onGameResume'); if (!MainGame.supportAudio) return; game.sound.mute = false;}, then, I call "pause game" in the Game.js for example like that: pauseGame: function () { MainGame.isPaused = !MainGame.isPaused; game.paused = MainGame.isPaused; if(MainGame.isMusicMuted){ game.sound.setMute(); }else{ game.sound.unsetMute(); }} and then, when the browser/tab loss focus, onGamePause and onGameResume don't work. main goal: to continue to play music after calling pauseGame, it's done as you see, but if the browser/tab loss focus - mute music.
  25. I've been trying to extend the functionality of TweenManager, so it can resume and pause everything within a group. I adapted the code from here: http://jsfiddle.net/lewster32/L3u3gp5k/ http://docs.phaser.io/TweenManager.js.html#sunlight-1-line-127 When debugging with console, _tweens and _add are undefined for each object, so the function doesn't work. I think the code is correct? Any ideas why this isn't working? I'm guessing i've missed something crucial about _tweens. Here's the code: (This goes out to Rich and Lewster) Phaser.TweenManager.prototype.pauseAllFrom = function(obj, children) {console.log('pauseAllFrom', obj.type, obj.name, obj._tweens, obj._add); var o, c, t, len; if (Array.isArray(obj) ) { for (o = 0, len = obj.length; o < len; o++) { this.pauseFrom(obj[o]); } } else if ( (obj.type === Phaser.GROUP || obj.type==7) && children){ for (c = 0, len = obj.children.length; c < len; c++){ this.pauseFrom(obj.children[c]); } } else { for (t = 0, len = this._tweens.length; t < len; t++){ if (obj === this._tweens[t]._object){ console.log('pauseFrom _tweens:',this._tweens[t]); this._tweens[t].pause(); } } for (t = 0, len = this._add.length; t < len; t++){ if (obj === this._add[t]._object){ console.log('pauseFrom _add:',this._add[t]); this._add[t].pause(); } } }};Phaser.TweenManager.prototype.resumeAllFrom = function(obj, children) {console.log('resumeAllFrom', obj.type, obj.name, obj._tweens, obj._add); var o, c, t, len; if (Array.isArray(obj) ) { for (o = 0, len = obj.length; o < len; o++) { this.pauseFrom(obj[o]); } } else if ( (obj.type === Phaser.GROUP || obj.type==7) && children){ for (c = 0, len = obj.children.length; c < len; c++){ this.pauseFrom(obj.children[c]); } } else { for (t = 0, len = this._tweens.length; t < len; t++){ if (obj === this._tweens[t]._object){ this._tweens[t].resume(); } } for (t = 0, len = this._add.length; t < len; t++){ if (obj === this._add[t]._object){ this._add[t].resume(); } } }};I also had to add a condition for the object type, as the console wasn't recognising Phaser.GROUP, and spitting out a number for each object type. // from thiselse if (obj.type === Phaser.GROUP && children){// to thiselse if ( (obj.type === Phaser.GROUP || obj.type==7) && children){Any help would be greatly appreciated. Thanks
×
×
  • Create New...