Search the Community

Showing results for tags 'update'.



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
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 57 results

  1. Hey all! I'm trying to update my game every time the screen is resized or turned from portrait to landscape and visa versa. What I'm doing right now is using window.onresize = this.resize(); but resize() is being called every frame. Does anyone either know why this isn't working or how to do this better? Thank you!!!
  2. Hi guys, I'm creating an UI for my babylon game via the Canvas2D, precisely the ScreenSpaceCanvas2D. Now I want to know if it's possible to update the text dynamically without recreating/overwriting the text2d child every time the score variable (which is used for displaying) is updated. Playground link for simplified case: http://www.babylonjs-playground.com/#2AVSFH#271 Thanks in advance!
  3. Hi, how can I add a function to the update function when two objects overlapped? I asked similar question yesterday but this time I asked same question in more clear way. For example, I will take a coin and after this my speedPlayer() function will be activated over and over again, infinitely. How can I do this, thanks.
  4. As far as I understand, updating the positions data on a mesh using updateMeshPositions - or other update* functions - only works when the mesh is set to be updateable. This setting can only be done at creation time. All basic shape creation* functions have the updateable option that can be set, but the standard mesh constructor has not. How do I make a custom shaped mesh updatable? I have thought of a workaround, by creating an updateable cube or something and replacing the vertices data with my custom mesh data. I have not tested this, but I will. And another question: it was my take that the updateMeshPositions is the fastest way to update the vertices positions. setVerticesData works also on non Updateables but seems to be slow. Is updateMeshPositions the fastest way to modify the vertices positions? And if not, what is? I am working on a sculpting app, my custom mesh has over 50K positions. Updating vertices is what the app is all about and I need it to be done as smooth and realtime as possible.
  5. I have a mesh imported from .babylon file, and it has its animations. I put MeshImpostor in, expecting it to update with the animation, but it's not. It seems like it uses the first frame as the reference to the collision detection. Is there any way to update it? Code is something like this: var mesh = scene.meshes[0]; mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.MeshImpostor); //I tried to force it update it too, but doesn't seem to work. function update() { mesh.physicsImpostor.forceUpdate(); }
  6. First post! I want to animate an object's position based on input from the user's mouse wheel. The mouse wheel can fire events many times per second. I don't want to destroy the old animation, and create a new one, for each of these many events. I'd prefer to "update" the keyframes of the existing animation instead (i.e. continue the animation from its current frame and position, to a new endPosition at a new keyframe). I'd also like to "restart" the animation again from its current value, if it happens to reach the final keyframe and stop, then the user scrolls again later. What is the preferred way to "update" an animation in Babylon.js? Can I just use animation.setKeys() again to update the keyframes? Also, if the animation completes, then more scroll events are fired later: how can I "restart" the animation from its previous end position, and trigger it to run again to a new end position? Thank you so much in advance for your help!
  7. Hi, I'm writing a class that extends Phaser.Weapon and i want that the method update() keep running, like this: class MissileWeapon extends Phaser.Weapon { constructor(game: Phaser.Game){ super(game, game.plugins); } update(){ /*this not execute*/ } } But it not running. If i add this "hack": class MissileWeapon extends Phaser.Weapon { constructor(game: Phaser.Game){ super(game, game.plugins); /*the hack*/ this.active = true; /*active plugin*/ this.hasUpdate = true; var test = game.plugins.add(Phaser.Weapon); /*Only for the game.plugins(PluginManager) start running*/ game.plugins.plugins.push(this); /*add my weapon in the PluginManager*/ } update(){ /*executing */ } } It seems that when extends of plugin Weapon, it not is added direct in the game.plugins (PluginManager), then the method update not executes. How could i make this without uses the "hack"? and i'm using Phaser version 2.6.2 thanks :-)
  8. I'm new to BabylonJS but one of the first things I notice is that almost all of the demos run slow (20-30 FPS is typical) on the same machine that is running three.js stuff fast. It seems like update/draw is not being called as often as it could be, as according to the debug overlay update and draw frame time is only 10ms in these same demos (so potential FPS is 100). Additionally I think BabylonJS suffers from timing flaws that other JS engines do, see this article: https://www.isaacsukin.com/news/2015/01/detailed-explanation-javascript-game-loops-and-timing In three.js I am using Mainloop.js to control update/draw timing logic. I think I would like to do the same in babylon.js, unless I am missing something. To expand further, physics should ideally be at a 30hz update rate in my game, but draw calls and other update logic should be at 60hz. Also update logic should be called at a very consistent 60hz, where draw can vary a bit from 40-60fps without real harm. (Draw lag spikes are permissible but update lag spikes should be dealt with by calling update twice to catch up and make game logic and especially physics have predictable behavior and equal time per step.) Is there a way without forking Babylon to override the update/draw timing logic? I notice the functions beginFrame() and endFrame() are public. Can I just call beginFrame, do my render calls, and then call endFrame? Will this break anything? What should "do my render calls" look like? Again I would prefer to not modify babylon.js itself, and instead just override its behavior because I don't want to maintain a fork.
  9. Hi all, I'm trying to create a coin counter in my game, using a bitmap font. Everything displays fine, and the counter works, however when a player collects a new coin, rather than replacing the '0' with a '1', it shows a '1', but underneath you can still see a '0' visibly. I've tried several work around methods, including even doing an if statement checking how many coins and replacing it with plain text rather than replying on the var count, and using coinText.updateText();. Does anyone have any ideas? I'll leave my code sample below. var crystalCount = 0; var coinText; //Skip down to the update section coinText = this.game.add.bitmapText(20, 10, 'carrier_command', "Crystals:" + crystalCount, 12); coinText.updateText();
  10. So i read it somewhere a few days ago the playground were open sourced by some individuals. I take a closer look at the code, i found at github. Now the question: So the half of it is missing. The Paths to the single source files needed are changed I think it is a good idea to make pull a requst first were all paths pointing again to https://github.com/BabylonJS/Babylon.js ??? and the do the hard stuff like, change buttons, ui, add new presets... textures. i think this is a difficult question. becourse the playground is running on a different server for now. and when i start to remap the paths back to babylonjs, its kind of counterproductive.
  11. So I have a group, and it has three sprites. create() { var parent = game.add.group(); var allSprites = [ 'sprite1', 'sprite2', 'sprite3']; for (i=0; i<3; i++){ childImage = parent.create( game.world.centerX, game.world.centerY+ (i*30), allSprites); childImage.anchor.setTo(0.5, 1); childImage.inputEnabled = true; childImage.input.useHandCursor = true; } } How to I trigger function changeText(); when one of the child sprite is clicked. So far I have tried this method below but it only detects click on the last sprite. update(){ child.events.onInputDown.add(changeText, this); }
  12. Hi guys, I have a problem with mesh picking and it is a specific case. When I create a ribbon like this, I can see it on the scene: var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE); On mouse down I am writing the name of the picked mesh in the log: handleMouseDown: function(event){ var pickResult = _scene.pick(_scene.pointerX, _scene.pointerY); var pickedPoint = pickResult.pickedPoint; console.log(pickResult.pickedMesh.name); // writes ribb when I click on it } BUT, when I update the ribbon mesh after creation, like this: var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE); someRibbon = BABYLON.Mesh.CreateRibbon(null, [[new BABYLON.Vector3(0, 0, 5), new BABYLON.Vector3(10, 0, 5)], [new BABYLON.Vector3(0, 10, 5), new BABYLON.Vector3(10, 10, 5)]], null, null, null, null, null, null, someRibbon); Then I can see that the ribbon that is updated (moved 5units along z axis), but it can't be picked. Actually, the picker "thinks" that the ribbon is still in the old position. Does someone have any idea how this could be solved?
  13. Hi guys, I was trying to make a group of objects and got the following error: phaser.js:45776 Uncaught TypeError: Cannot read property 'length' of undefined Everything seems to be fine, anyone has a clue why this might be happening? FYI: I'm using Phaser 2.5.0 Thank you for your help.
  14. Now I meet a problem:I do many things in my create() function,so when the game logic enters into the update() function,the create() function have not been executed completely,but in update() function , it will use something in create(),so it causes problems,is there a way to avoid this by setting up a delay time for update(),let it to executed after function create() has been executed completely?
  15. Check out BlockTanks, a simple yet addicting MMO Tank Game made with nodeJS and Websockets. In BlockTanks, you move a tank and shoot players on the opposite team, getting as many kills as you can. No need to create an account, just type in a name and play! The game's features include: Real time player combat A maze-like map that two teams of tanks can navigate through Four types of power-ups Chat features Tank Skins I made a post about this game a few weeks back, and I have been working on the game since. Here are the new features: By popular request, I've made an invincibility power-up that lasts for ten seconds. The map changes every day to keep the game interesting. I have added more tank skins, along with a list of all the current working tank skins. Server bugs have been fixed to reduce server crashes. A respawn timer has been added and the kill count at the top has been redesigned. Play the game at: blocktanks-kevdude749.rhcloud.com Hope you like it! Also, if anyone has any tips/experience with promoting and marketing a game, I would be glad to know UPDATE: BlockTanks now has a bot feature which allows for single player gaming when no one else is online (which occurs often ). If you log on and there is no one else online, a bot will spawn on the other team and fight against you until someone else joins. Please give it a try and let me know what you think of the new AI!
  16. I am getting the following gamepad exception. babylon.max.js:39351 Uncaught TypeError: this.babylonGamepads[i].update is not a function Gamepads._checkGamepadsStatus @ babylon.max.js:39351 Gamepads._startMonitoringGamepads @ babylon.max.js:39340 Gamepads._onGamepadConnected @ babylon.max.js:39304 Gamepads._onGamepadConnectedEvent @ babylon.max.js:39276 For purposes of what I am doing, while I do have a gamepad connected on my system, I could care less about gamepad features. I do not use a game pad at all for this. That I know of, this just recently started happening, or is intermittent, with the one or two couple of version(s).
  17. Hello, We updated the Sublime Text plugin for Phaser with the last Phaser version (2.4.7). With this plugin you get Phaser API code completions.
  18. Hi guys! I have a tube mesh, created with an array of Vector3 points. I update this tube mesh adding new points to the path, but for some reason it's giving me errors like Uncaught TypeError: Cannot set property '0' of null Uncaught TypeError: Cannot set property 'x' of undefined http://babylonjs-playground.com/#85J9N#10 What am I doing wrong?
  19. Tilt The Dot (Android Game) This is my first Android game made with the phaser framework called Tilt The Dot. To play, tilt your device to move a little dot on the screen. Move the dot to hit the blue goals. How high can you score? The game currently consists of 9 characters, a leaderboard, and arcade style graphics. Since the last update, I have added several new and improved features including: - A more comprehensive tutorial - New character! (Dog) - Adjustable device sensitivity - 3-second countdown before gameplay Play it on Android here: https://play.google.com/store/apps/details?id=com.tiltthedot Hope you like it!
  20. Hi everyone, I'm developing a simple game where objects visually approach the screen and you have to click on them before they visually reach the screen. However, I was getting mad when trying to add tweening to the sprites representing the approaching objects. They should fade out and in when hit to give a visual feedback to the player that they've been hit. I tested tweens in an extra stage and everything worked fine, so I adapted those three lines of code to the hit callback in the gameplay stage of the game. The tween wouldn't start at all. Before the first time the tween's start function was invoked, its startTime attribute was set to null, after that it changed to 0, but visually, nothing happened. So I wondered if I missed something, commented out all the stuff that could interfere like the content of the update function, where the scale of each approaching object is adjusted and so on. In the end, I had an object with a hit function, a click callback and a sprite, still standing. And still - nothing happened. So just before I wrote this post right here, I tried commenting out the whole update function, including its declaration, from the stage and voilĂ . The tween works like a charm. So to sum up, tweening a sprite doesn't work when an update function is present in the stage to which the sprite belongs. Is this behaviour intended? Is it to fix in a coming release? What is the best practice so far? Greetings, Roberto
  21. Hi, after many requests and also issues with the latest Chrome update / webgl crash on Windows MightyEditor has been updated to the most recent Phaser version (2.4.4). From now on, all the new projects by default will use Phaser 2.4.4 If you are experiencing errors or crashes feel free to contact us at github: https://github.com/TheMightyFingers/mightyeditor/issues or directly, e-mail: [email protected]
  22. Hi there. I have a noob question... How I can update bounds of nested sprites? For example: I have a sprite levelSprite = this.game.add.sprite(0, 0); //now width and height - 32x32This sprite has two childs levelNum1 = this.game.add.sprite(0, 0, 'game_assets_4');levelNum1.frameName = "gm_level_number_0001.png";levelNum2 = this.game.add.sprite(100, 100, 'game_assets_4');levelNum2.frameName = "gm_level_number_0002.png";levelSprite.addChild(levelNum1);levelSprite.addChild(levelNum2); // now width and height still 32x32... why? I use phaser v. 2.4.3 Would you be so kind to help me please...
  23. Hey guys, just a quick one.. Could anybody recommend or argue against putting: this.world.sort("z");Inside the update loop. I have lots of groups that have constantly changing z values. Just curious to see how others do it Thanks Nick
  24. Hi everyone! Phaser version: 2.4.3. My intention was to render the cellular automata generated map on the screen. To do this I created a BitmapData object and used a basic set of setPixel(...) loops. Everything works but it took 8 seconds when the 'immediate' flag is true. And when the 'immediate' flag is false the map image just won't be visible at all while the console.log(...) says everything is finished so there's no freezing. Thus, the problem is in bmd.update(...) in the end that has no effect at all. Tried filling the entire bitmap with the white color before the loops: the entire bitmap is white but there's no trace of setPixel calls. create: function this.bmd = this.game.make.bitmapData(automata.width, automata.height);for (var i = 0; i < automata.width; i++) { for (var j = 0; j < automata.height; j++) { if (automata.cellmap[i][j]) this.bmd.setPixel(i, j, 255, 255, 255, false); }}this.bmd.update(0, 0, automata.width, automata.height);var img = this.bmd.addToWorld();img.smoothed = false;img.scale.set(2);
  25. Hello everyone, I'm back again with a question. I have a scene (see screenshot below) that is static after the construction has finished. I want to render shadow once after the construction. I tried "renderTargets" off. But the shadow sometimes disappears. I would need something like a shadowgenerator manual mode. So like "calculateShadow" and then it keeps this shadow map until the next "calculateShadow" call. Is there something like that or an easy way to achieve that? I think this is something useful for other users too. Have a nice day, Kevin