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
    • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 71 results

  1. Nabroski

    Playground Github

    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.
  2. 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); }
  3. Dejan

    Picking updated mesh

    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?
  4. 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.
  5. 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?
  6. 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!
  7. 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).
  8. 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.
  9. 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?
  10. 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!
  11. 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
  12. 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...
  13. megmut

    World Sort in Update Loop?

    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
  14. 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
  15. So i've recently been building a game in Phaser, trying to keep objects as modular as possible, which lead me to this question. I have a main game state that currently handles all input events and moves / mutates objects as necessary, e.g. player, enemies, particles, etc, each being a modular object which is required using browserify. I wanted to keep all input handling / updating within this function to reduce the function calls I'm making each frame (to reduce delta times). My question is, would this actually yield noticeable efficiency improvements, or should I just pass a reference to the game object to each module to handle their own input / updating. Considering objects pass by reference, this shouldn't be an issue right? FOR EXAMPLES SAKE, So basically instead of update: function() { game.physics.arcade.overlap(enemyBullets, tank, bulletHitPlayer, null, this); enemiesAlive = 0; for (var i = 0; i < enemies.length; i++) { if (enemies[i].alive) { enemiesAlive++; game.physics.arcade.collide(tank, enemies[i].tank); game.physics.arcade.overlap(bullets, enemies[i].tank, bulletHitEnemy, null, this); enemies[i].update(); } } if (cursors.left.isDown) { tank.angle -= 4; } else if (cursors.right.isDown) { tank.angle += 4; } if (cursors.up.isDown) { // The speed we'll travel at currentSpeed = 300; } else { if (currentSpeed > 0) { currentSpeed -= 4; } } if (currentSpeed > 0) { game.physics.arcade.velocityFromRotation(tank.rotation, currentSpeed, tank.body.velocity); } land.tilePosition.x = -game.camera.x; land.tilePosition.y = -game.camera.y; // Position all the parts and align rotations shadow.x = tank.x; shadow.y = tank.y; shadow.rotation = tank.rotation; turret.x = tank.x; turret.y = tank.y; turret.rotation = game.physics.arcade.angleToPointer(turret); if (game.input.activePointer.isDown) { // Boom! fire(); }}I'd have something like update: function() { this.tank.update(this.game); this.turret.update(this.game, this.tank); this.shadow.update(this.game, this.tank); // etc etc}
  16. I have a scene that I update every frame by calling scene.render(). I want to be able to run all the scene calculations, but without drawing to the canvas. How can I update the scene without telling it to draw to the engine's canvas?
  17. spinnerbox

    Timer vs update

    In my memory game there are two loop timers, one which runs on each 100 milliseconds and second on each 1000 milliseconds. We cannot forget also the update() function which comes along the Phaser.State class. In the 100 mil timer I do stuff like replacing cards by position, and showing helper arrows. On the 1000 mil timer I just increment the clock by one second. All works well but the code got kind of too cluttered so I am afraid, I could break something at this point. For best performance, is it good to use only one timer and no update() method or should I just move all in update() method and count the number of frames passed?
  18. Hi, doc for exists property in Phaser.Group reads: "If exists is true the group is updated, otherwise it is skipped." But when I look into preUpdate(), update() and postUpdate() source, this property is taken into account only in preUpdate() method. Is it intentionally or is check for exists value missing in update() and postUpdate() methods?
  19. Hi, I'm new to HTML 5 game dev and maybe the next question is very easy for the experienced but I can't seem to find a good solution, so don't shoot. The question isn't strictly related to HTML 5, it is more like a generic question for every platform. For the sake of simplicity, we are given: one update timer that runs 4 ms in its own thread, one render timer that runs 10 ms in its own thread. Usually, game's loop clears the entire screen before the render operation, but we all know this is not always a solution for games when going javascript and/or mobile. So, there are games (e.g. tetris) where we need to handle states of objects (that may move or may not move). The most efficient loop for such a game is to: draw the current moving brick without redrawing the entire screen, wait a second and DO NOTHING, then delete the area of the old brick ONCE, update the brick position ONCE, draw the brick ONCE. I have written the capital words because I can't find a solution for handling these situations. And now the questions start. How do you do such things once in a multi-threaded environment without spamming these operations ? Assume that a new brick is created at uf 1 (uf = update frame), i send it to be rendered, so I do nothing on uf 2 (I have to wait a second). Since rf 1( = render frame) happens after uf 2, how do I remember to draw from uf 1 rather than uf 2 (because uf 2 contains no changes). You may say to keep them in a list of "drawables" and just render that list. But what if uf2 actually contains changes ? Using the above list, i would have a list like [delete uf 0, draw uf 1, delete uf 1, draw uf 2] sent to render. This is not very efficient. You may say to reduce this list by removing opposite commands like "draw uf 1" and "delete uf 1", and only have "delete uf 0" and "draw uf 2". This may also take some serious time to compute every possible combination of reduction, but i may be wrong here. Besides that, doesn't that constitute a danger to other objects that may overlap my "state" object ? like not being displayed properly or being cut but by the "delete uf 0" which is an old state when render happens. Do you have an efficient solution for this ?
  20. bigtunacan

    Updating tiles not working?

    I'm trying to update properties on tiles within a tilemap layer once the player has moused down on a tile. When I try this though, my tiles never get updated. I tried the following as a basic test where I directly update a single tile in the layer all of the time to make sure that the update was working and this works correctly. function update(){ foobar = bg_map_layer.getTiles( 14,113, 1, 1); foobar[0].alpha = 0.5; foobar[0].rotation = 40;}So here I'm trying to update the tiles in update after they have been moused down on... function update(){ if(game.input.mousePointer.isDown){ mouseX = game.input.mousePointer.x mouseY = game.input.mousePointer.y if ((mouseX > 867 && mouseX < 74) && (mouseY > 77 && mouseY < 72)) { play_button.x=867 play_button.y=77 } arr_touched_tiles = _.union(arr_touched_tiles, bg_map_layer.getTiles( 300,300, 100, 100)); arr_touched_tiles = bg_map_layer.getTiles( game.input.mousePointer.x, game.input.mousePointer.y, 10, 10); } for(var i = 0; i < arr_touched_tiles.length; i++){ arr_touched_tiles[i].alpha = 0.0; arr_touched_tiles[i].rotation = 40; } }On this second version I never see the tiles change. When I try to inspect it in the browser console it gets into my for loop and the values appear to be set on the tiles, but they do not display with the alpha + rotation.
  21. UseTheForceFrodo

    Live Text Update Question

    I'm aiming towards having a small text panel on the left hand side of the screen which contains data pertaining to my sprites (position etc). I wouldn't know how to set live updating text in Phaser though. I made this little sandbox to help explain: http://phaser.io/sandbox/HztzhGmk Where I have the text "circle position" is where I would like live updates of the circle's x and y position [ example: game.add.text(10, 32, "x: " + sprite.x, style); ]. The circle is draggable, but I'm not sure how to access and display the positional values for a sprite in real time. Any help much appreciated. Many thanks in advance.
  22. In my game, i have a timer event which will run for 60 seconds. This is a startGame function in coffeescript. Which has a time event in bold letters. I passed @seconds_counter value which is 60. So this timer will count till 60 seconds and afterthat calls @removeCounter function. startGame: -> left_button = @add.button(60, 350, 'button', @checkAnswerForLeft, this) right_button = @add.button(460, 350, 'button', @checkAnswerForRight, this) @time.events.remove @timer # Start main game counter @seconds_timer = @time.events.loop(Phaser.Timer.SECOND, @updateSecondsCounter, this) @time.events.add Phaser.Timer.SECOND * @seconds_counter, @removeCounter, this In my game i want to give users a time bonus in which i want to add extra seconds to this time event. I added 10 seconds to @seconds_counter but it won't affect this timer event. So in short, my game loop is 60 seconds. If user get time bonus then add 10 seconds to game loop so for that user gae will be of 70 seconds and after that @removeCounter function should call. Is there any way to update time for running timer??
  23. I'd like to implement my pause screen so I'm looking for the line in the code that calls arcade physics update. Any ideas?
  24. Hi All, This is my first post, my first user of a forum, my first use of Phaser, my first game that I'm thinking of making, my first everything... So please bear with me if I'm doing sth unusual here I am looking at Phaser for a pixel-art game. One thing that I cannot get through my skull is how the update() should work. Therefore I made some assumptions for which I'd like to know if they're OK. update() is called imediately after a repaint. Then you have around 1000 / 60 ms to do your stuff (logic + rendering). And if you're fast enough, whatever you did there (moved sprites around etc.) will show at the next refresh (repaint). I also assume that update() is called via requestAnimationFrame under the hood. So the construct under the hood is something like this: update() { requestAnimationFrame(update); // logic // rendering } If this is all true, then what happens if the frame rate drops? Your "logic FPS" drops as well and the game slows down? Am I suppose to use a physics engine to counter this? If I don't want to use physics, how do I go about this? Do these two posts provide an answer: http://www.chandlerprall.com/2012/06/requestanimationframe-is-not-your-logics-friend/ http://impactjs.com/forums/impact-engine/misuse-of-requestanimationframe ...if yes, how do I do this (properly) in Phaser? Is something like this already in place? Thanks, best regards, mIHA
  25. I have yet to try it, but like the title says can I? I figure that even if I do try it, and it works there will be some unknown thing that will cause issues. So say I've got a sprite. At some time during the game I set sprite.update = function(){ //code }; will harpies come to take me away for my transgression?