Search the Community
Showing results for tags 'dynamically'.
-
Hi all, i'm having some troubles with loader and sprites.... I load all my general purpose sprites at begining without problems, they works fine, the problem appears when i try to load a new sprite when i press a button. I need to load a new "rotating planet skin" when a button is pressed. for my general purpose textures i load them like this.. var ef_circulo = []; var ef_transicion = []; const ef_energia = []; var textura_ef_circulo,textura_ef_transicion,textura_ef_energia; var ef_planeta = []; var textura_ef_planeta; const cargador = new PIXI.Loader(); cargador.add('circulo', 'img/ef_circulo.json') .add('transicion','img/efectos/transic.json') .add('energia','img/efectos/energia2.json') .load(efectos_cargados); function efectos_cargados() { // create an array to store the textures var i; for (i = 0; i < 74; i++) { textura_ef_circulo = PIXI.Texture.from('ef_circulo_' + (i) + '.png'); ef_circulo.push(textura_ef_circulo); } var explosion = capa_flotas.addChild(new PIXI.AnimatedSprite(ef_circulo)); explosion.anchor.set (0.5,0.5); explosion.pivot.set (0.5,0.5); explosion.gotoAndPlay(0); explosion.scale.set(1); explosion.rotation = (90*3.1416)/180; explosion.position.set (175, 35); explosion.animationSpeed = 0.4; for (i = 0; i < 25; i++) { textura_ef_transicion = PIXI.Texture.from('transicion_' + (i) + '.png'); ef_transicion.push(textura_ef_transicion); } transicion = sistemas.addChild(new PIXI.AnimatedSprite(ef_transicion)); transicion.scale.set(1); transicion.width =1024; transicion.height = 200; transicion.animationSpeed = 0.8; transicion.loop = true; // cargo las imagenes del efecto de energia for (i = 123; i > 0; i--) { //textura_ef_energia = PIXI.Texture.from('energia_' + (i) + '.png'); textura_ef_energia = PIXI.Texture.from('energia2_' + (i) + '.png'); ef_energia.push(textura_ef_energia); } } The previous code load some sprite textures for spaceships, stars.... Now i need to load 9 (for 9 planets on that star) new sprites depending on the star button pressed, and i'm trying this but didn`t work at all for (var i = 0; i < sistema_solar.planetas.length; i++){ if(sistema_solar.planetas[i].nom_jug.length != 0){ planetas[i] = new Planeta(...more data here,sistema_solar.planetas[i].img_planeta); } } function Planeta(some variables here,imagen_planeta) { ...more stuff here var loaderNumberNine = new PIXI.Loader(); //loaderNumberNine.add('planeta_g', 'img/sistema/p1.json'); loaderNumberNine.add('planeta_g', imagen_planeta); loaderNumberNine.load(function(loader, resources) { /*thats onload for you*/ var i; for (i = 0; i < 149; i++) { textura_ef_planeta = PIXI.Texture.from('p1_' + (i) + '.png'); ef_planeta.push(textura_ef_planeta); } }); ...more stuff here and i put the new sprite into a container. this.planet = cont_sistema.addChild(new PIXI.AnimatedSprite(ef_planeta)); this.planet.play(); this.planet.animationSpeed = 0.25; ...more stuff here } it works but not as espected... if i use loaderNumberNine.add('planeta_g', 'img/sistema/p1.json'); i alwais have the same planet skin if i use loaderNumberNine.add('planeta_g', imagen_planeta); where imagen_planeta is 'img/sistema/p1.json' or 'img/sistema/p2.json', or 'img/sistema/p3.json'.. it alwais load the first .json on the 9 sprites any help whould be much apreciated Edit: i forgot to mention i'm using PixiJS 5.3.6
- 1 reply
-
- dynamically
- sprites
-
(and 1 more)
Tagged with:
-
This is more of a questions really. Searched a bit around the issues, change-log and this forum but couldn't find an answer for it. I'm loading bunch of scripts dynamically via game.load.script. As expected I can't put brekapoints and debug those scripts. I'm aware of sourceURL solution, but couldn't get it working. Is there any way to put breakpoints and debug dynamically loaded scripts? Any help or information would be appreciated.
-
Heya, I'm building a game in which I can enter a building, which I'm handling via states. In other words, when my character overlaps with the door, the program starts a new state in which the interior of the building is built. Now, I want the interior to have smaller dimensions than the world, so I want to change the game size when I start this new state. I tried this: create: function(){ //game size was 1000x700, I want to scale it to 700x450 game.width = 700; game.height = 450; //rest of creation code...}I also tried things like changing camera bounds, world bounds, world size, but method above shows the most promise. The problem, however, is that the resize for some reason does not show until I click away from my browser tab and back. Calling game.width in the console yields 700 at all times, but it doesn't show it as such until tabbing out and back. On top of that, the contents of the game (floor, furniture, character) are scaled down when the game resizes, defeating the purpose. I don't understand why it would, since there's no scaling anywhere in my code. Any help would be greatly appreciated.
-
hi there I have a problem like mine. I want to upload pictures from an address now. necessarily have to make it through, but staying in preload. Once the game starts loading can not I? preload:function() { this.game.load.image('profilepic','https://abc.com/profile.jpg');}profileButtonAction:function() { profileButton.loadTexture('profilepic');}i want; profileButtonAction:function() { this.game.load.image('profilepic','https://abc.com/profile.jpg'); profileButton.loadTexture('profilepic');}or async image loader? Please do not solve these issues
-
Hi! I have a sprite scaled to a smaller size (0.5, 0.5). I want that when the player press the "down" the size change. What occurs to me is that changes the size but scaled back to (1, 1) Greetings!
- 5 replies
-
- size
- dynamically
-
(and 1 more)
Tagged with: