Search the Community
Showing results for tags 'phaserce'.
-
I am trying to create multiple PIXI.Texture instances using a Phaser.RenderTexture as the base. This does not seem to work though. When I set the texture on a sprite it just appears blank. Doing the same with a baseTexture from the cache seems to work. const texture = new PIXI.Texture(renderTextureInstance, new PIXI.Rectangle(0, 0, 200, 200), new PIXI.Rectangle(0, 0, 200, 200)); // DOES NOT WORK const texture = new PIXI.Texture(game.cache.getBaseTexture('buttons'), new PIXI.Rectangle(0, 0, 200, 200), new PIXI.Rectangle(0, 0, 200, 200)) // WORKS I also tried using the renderTextureInstance.baseTexture reference and neither seem to work. When I create a sprite using the renderTexture it works just fine. Is this Some limitation of RenderTextures in the Phaser 2/CE code? Is there a workaround? thanks
-
I have a group that contains a large number of children that are P2 physics objects. When I tween the group the sprites all move correctly, but their collisions occur in the position they were prior to the tween. Is there a good way to update the position of the bodies of all the children? Heres some super simplified code incase it helps: game.physics.startSystem(Phaser.Physics.P2JS); const collisionGroup1 = game.physics.p2.createCollisionGroup(); const collisionGroup2 = game.physics.p2.createCollisionGroup(); const targetsGroup = game.add.group(0,0); const ammoGroup = game.add.group(0,300); const target1 = targetsGroup.create(0,0, "key"); const target2 = targetsGroup.create(50,0, "key"); game.physics.enable(target1, Phaser.Physics.P2JS); game.physics.enable(target2, Phaser.Physics.P2JS); target1.body.setCollisionGroup(collisionGroup1); target1.body.collides(collisionGroup2); target2.body.setCollisionGroup(collisionGroup1); target2.body.collides(collisionGroup2); const bullet = ammoGroup.create(0,0, "key2"); game.physics.enable(bullet, Phaser.Physics.P2JS); bullet.body.setCollisionGroup(collisionGroup2); bullet.body.collides(collisionGroup1); game.add.tween(targetsGroup.position).to( {y: "-100"}, 300, Phaser.Easing.Quadratic.Out, true ); Any help would be greatly appreciated, cheers
-
Hi, i have some assets (on dropbox) that i've found on the internet and i want to have them online like what did @samme on jsdeliver this way do you have any idea on how to do it preload: function() { game.load.baseURL = 'https://cdn.jsdelivr.net/gh/samme/[email protected]/'; game.load.crossOrigin = 'anonymous'; game.load.image("bar", "sprites/zelda-life.png") }