Search the Community

Showing results for tags 'refresh'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • 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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 7 results

  1. Maybe it's a silly question. I am applying alpha to an image and in the line immediately after I alert a message on screen. The problem is that the alpha is being shown up only after the alert popup be closed. There is a method that I can invoke to force screen to update BEFORE the alert? Thanks!
  2. I did a function resize to resize the game follow the size of the screen and at the end of this function I do : game.scale.refresh(); But I would like to catch the event of this function like this : var scaleRefresh = game.scale.refresh(); scaleRefresh.onComplete.add(function(){ //DO stuff }); But it's not work how can I do this?
  3. We can render a scene in Babylon.JS reading values like position/scale from form fields. But does it allow to make changes in scene listening real time changes in input fields like $('input').val() var cusotm_position = $('input').val(); canvas = document.getElementById("renderCanvas"); engine = new BABYLON.Engine(canvas, true); scene = createScene(); //draws a mesh at custom_position engine.runRenderLoop(function () { scene.render(); }); $("input").change(function(){ cusotm_position = $('input').val(); delete scene;scene = createScene(); //hangs website for few seconds,need its alternate }); I tried to call scene.render(); on event listener of change in input but that doesn't seem to be doing anything. Is there anything like refrest/update to change to updated variable values. Better if this can be done without removing everything and recreating fresh scene. As delete scene;scene = createScene(); does refresh everything with new variable values but it hangs the website for few seconds.
  4. AlbertTJames

    Text2D does not refresh its text

    Hi, I have a Text2D in a Rectangle2D, I change the text every 200ms but it does not refresh on the screen. Although when looking at the text property it changes properly. The text refreshes only if I set its levelVisible property on and off at each tic. I do not have this problem in the playground so I am not sure what is going on. state.tic = function () { const text = newText() // this works state.tooltipPause.text.text = text // setting the parent rectangle2d levelVisible // is the only way i have found to refresh the view = true // delay is simply a promise that will resolve in 200ms delay(200).then(() => { = false state.tic() }) } Just sharing the little hack I found, in case someone else has the same problem
  5. In my game, when a user presses the "upgrade" button the game pauses and a menu is displayed which allows the user to upgrade their skills. This works fine except that as the skills are increased they do not update on the screen until after the game "resumes" from being paused. I need a way to update or redraw the screen without unpausing the game. I would even be happy with some sneaky method of unpausing and then re-pausing after 1 draw cycle or something to that effect. The items I'm trying to update are hud elements such as heart containers and available points and such. Any suggestions are appreciated. I'm brand new to the forums and I've been using Phaser for about 1 week, so sorry if my post is in the wrong area or anything.
  6. I recently came across on a really strange behavior with game.time. What I am trying to do is to update my character position regardless of the monitor refresh rate, i.e regardless if my monitor is setup on 60hz, or 50hz, I want to move my character the same amount of pixels for the same amount of time. In a previous topic, I have been advised to update the position at a factor of the elapsed time since the last frame. // Get the time in seconds since the last framevar deltaTime = game.time.elapsed / 1000;// Move the character to the right at 500 pixels per second, regardless of frameratecharacter.x += 500 * deltaTime;Doing so surprisingly didn't fixed my problem and my character was still moving slower at 50hz than on 60hz. Digging into the issue showed that the math was correct, but the game.time is falling behind the 'real' time when running on 50hz. I have setup a simple example, which shows this behaviour. I am moving a ball from the left side of the screen to the right. Once the ball leaves the screen, I determ what time has passed both using game.time and Date(). Running this example on 60hz shows similar values, while running on 50hz shows a big difference between both times with game.time falling behind from 'real' time. test.prototype = { this.ball = null, this.phaserTime = 0, this.startTime = 0, this.timeSet = false; this.collisionDetected = false; preload: function() {'img', 'ball.png'); }, create: function() { this.ball =,, 'img');; this.ball.checkWorldBounds = true;, this); }, update:function() { if(this.collisionDetected) { return; } if(!this.timeSet) { this.startTime =; this.phaserTime = 0; this.timeSet = true; } var deltaTime = / 1000; this.ball.x += 300 * deltaTime; this.phaserTime += deltaTime; }, worldCollide: function() { this.collisionDetected = true; var realTime = ( - this.startTime) / 1000; var deltaTime = / 1000; this.phaserTime += deltaTime; console.log('Phaser time', this.phaserTime); console.log('Real Time', realTime); }}Test on 60hzupdate - 122 callsPhaser time - 2.017 secReal Time - 2.027 sec Test on 50hzupdate - 121 callsPhaser time - 2.029 secReal Time - 2.411 sec If someone can explain this behavior I would be really grateful as I really want to make my game independent from the monitor frequency.
  7. What is the best way to empty memory from reloading this same scene to not double memory slot. I realize that each time I refresh page consumption of memory just adding. I try: var engine = null;var scene = null; or if (scene) { scene.dispose(); scene = null; } is there any other, best way to dump from memory scene and engine before start again this same or just remove any other so they not use memory and CPU!?