Search the Community
Showing results for tags 'reuse'.
-
Hi, Is there any method to reset an emitter properly to be reused ? because i reuse a set of emitters but sometimes when i reuse a previously used emitter it show quickly his last state (repartition of particules in their last coordinates) and then restart his animation, so i wonder if is it a bug or a bad use. EDIT : It's a bad. Code used to instanciate the emitters in the poolEmitter (extended Phaser.group) instance : em = game.add.emitter(10,16,30) // some emitter settings (minRotation, setXSpeed,makeParticles...) em.kill() this.add(em) Code used in the poolEmitter instance to get a free (dead) emitter : let obj = this.getFirstDead(false) obj.revive() obj.x = x obj.y = y return obj Code used for exploitation of the emitter : let em = poolEmitter.create(player.x ,player.y) em.explode(800,30) setTimeout(function(){ em.kill() em.on = false em.visible = false /* em.forEach(function(p) { // I try this to hide the particule manually to avoid to be showed in their last coord when reuse the emitter, but dont work p.alpha = 0 })*/ },900) Thanks
-
Hi there, Can anyone tell me what I'm doing wrong here? I just need an array of sprites with inputOver events. Right now it works on the first load of the menu and not thereafter. It needs to load 4 times in the game. Currently I'm doing this: var createPanels = function(){ // draw panels for (var i = 0; i < 4; i++) { lightPanels[i] = game.add.sprite(ProgressModel.gameRooms[i].x * game.width, ProgressModel.gameRooms[i].y * game.height, 'room-light-' + (i + 1)); lightPanels[i].name = i; lightPanels[i].inputEnabled = true; lightPanels[i].events.onInputOver.add(over, this); lightPanels[i].events.onInputOut.add(out, this); lightPanels[i].events.onInputDown.add(selectRoom, this); lightPanels[i].events.onInputUp.add(Up, this); } }; How should you create sprites in an array with events that are reusable on subsequent state loads? There are no errors, the inputOver event just doesn't fire (the input down works fine every time) Any input is much appreciated. Thanks, H
-
How can I use the same mesh for 2 different object in the 3D space ? What I tried: //... //before the mesh is loaded we use another mesh hero = BABYLON.Mesh.CreateSphere("sphere1", 16, 0.1, scene); enemy = BABYLON.Mesh.CreateSphere("sphere2", 16, 0.1, scene); BABYLON.SceneLoader.ImportMesh("fr", "/", "models/5.babylon", scene, function (newMeshes, particleSystems) { camera.target = newMeshes[0]; hero = newMeshes[0]; enemy = newMeshes[0] //how can I separate hero and enemy again ? } ); //... If there are different ways to do , give me the one that uses the least resources.
-
Hello! In my Title Stage I added a background and a button to start the game. When the button is pressed it goes to the Stage named Play where all the logic must happen. But all goes black/blank. How can I go from one stage to another without recoding all my sprites and images from the title? Is there some way to just add them on the new stage? Thanks!