• Content count

  • Joined

  • Last visited

  1. Phaser Examples - loading files without states

    Have you tried: game.input.onDown.addOnce(this.updateText, this); or better: game.input.onDown.addOnce(function(){this.updateText()}, this); ?
  2. Creating multiple popups with too many functions?

    In your function put sender as parameter, in that case it will be the button clicked, so you can have just one function to manage them all. function openWindow(sender){...}
  3. How to render a HTML page inside Phaser?

    The problem was that parent div has fixed width and height but the child div do not inherited them and had 100% innerwindow width and height without any reason. Solved with a CSS rule... but in any tutorial I've saw says it is unnecessary because there it should be implicit inheritance.
  4. How to render a HTML page inside Phaser?

    Thanks for the answer @alex_h. No, it's in another page. I've parsed the page as a string and substringed it in a variable. Now, while I render the variable with mydiv.innerHTML = mystring; it render it full page. I've tested cutting my HTML file to just the div that I want and render the full page with: mydiv.innerHTML = "<object width=\"100%\" height=\"100%\" type=\"text/html\" data=\"" + myhtmlpage + "\" ></object>"; it render mydiv size. How can I have the same result in the string version too? Update: The problem is that with the first method all divs in mystring have width 100% and height 100% instead of width and height of parent div (mydiv).
  5. Make Graphic into Sprite

    You could try to put things in two different gorups and render the sprite group above the graphic group or use the same group and add child in right order.
  6. How to render a HTML page inside Phaser?

    What if, instead of a full HTML page, I've to render just a <div id="bla-bla-bla">content</div> to render?
  7. input.onDown doesn't respond on certain smartphones

    Do you have the same issue with input.onUp?
  8. This context matters

    Good morning guys! I've created a class to manage my sliders in Phaser 2.6.2 with Typescript. I create an object slider like this in file a.ts: let slider = new Slider(game, x, y, width, height, mycallback); mycallback is like that: export function mycallback(value: number): void { usedvalue = value; } My slider class is like that: export class Slider extends Phaser.Group { protected value : number; constructor ( game : Phaser.Game, x : number, y : number, width : number, height : number, onClickCallback : Function ) { super(game); console.log(this); } setParameter(sender) { this.value = sender.width - sender.x; console.log(sender); console.log(this); this.onClickCallback(this.value); sender.onClickCallback(this.value); } } Ok, now both this.onClickCallback(this.value); and sender.onClickCallback(this.value); return an error "onClickCallback is not a function". The first console.log(this), the one inside the constructror, give me the right log writing Slider and all his values. The second console.log(this) and console.log(sender), the ones in setParameter, return me game. What is my error? How can I resolve this?
  9. drawRoundedRect width immutable

    I've a similar problem. My roundedRect width change... but it is not drawed. RoundedRect.beginFill(color); RoundedRect.drawRoundedRect(10, 0, 1, 12, 6); RoundedRect.endFill(); RoundedRect.beginFill(color); RoundedRect.width = sender.x; RoundedRect.endFill; RoundedRect.width became equals to sender.x but it is disappear from the screen without any reason. Console.log give me the right values of x, y, width and height.
  10. Is phaser a drag and drop engine?

    No, it's not a drag & drop engine.
  11. Wow... that's a really big bug! O_o What Phaser version do you use?
  12. What is context

    Context is where the object "exist". game/this are most common context.
  13. Good morning guys! I've to load a HTML page (rules, instructions, settings, ecc...) inside my Phaser game, how can I reach this goal? Can I control that page with Phaser buttons? Can I render some Phaser button inside this HTML to manage the settings? I need that is a HTML or PHP page to be reachable and visible even outside the game.
  14. Dot move with trail

    That's what I've done: Create: game.physics.startSystem(Phaser.Physics.ARCADE); sprite = game.add.sprite(0, 0, image); game.physics.arcade.enable(sprite); sprite.body.bounce.set(0); sprite.body.velocity.set(300, 200); sprite.anchor.set(0.5, 0.5); sprite.alpha = 0; emitter = game.add.emitter(0, 0, 400); emitter.makeParticles(image); emitter.gravity = 0; emitter.alpha = 0; emitter.emitX = -50; emitter.emitY = -50; emitter.setYSpeed(min, max); emitter.setXSpeed(min, max); emitter.setAlpha(1, 0.5, 1000); emitter.setScale(0.8, 0, 0.8, 0, 1000); emitter.align(-1, 10, 100, 36); game.physics.arcade.gravity.x = 0; game.physics.arcade.gravity.y = 0; game.physics.arcade.checkCollision.left = false; game.physics.arcade.checkCollision.right = false; let tween = game.add.tween(sprite).to( { x: [x], y: [y] }, 1000, Phaser.Easing.Linear.None, true, 0, 0, false) .onUpdateCallback(function (target, tween) { emitter.emitX = sprite.x; emitter.emitY = sprite.y; emitter.start(true, 1000, null, 10); }); tween.frameBased = true; tween.onComplete.add(function () { spritePoint.alpha = 0; spritePoint.x = 0; spritePoint.y = 0; emitter.alpha = 0; emitter.emitX = -50; emitter.emitY = -50; emitter.forEachAlive(function (particle) { particle.kill(); }, this); }); game.world.wrap(spritePoint, 1, false, true, false); For me, Firestarter example is what is best for you.
  15. Sound effects mashed up

    You have to call a function to manage what sound reproduce. Instead of: this.footstepA.play(); put a: soundplay(); Then in soundplay you put all the stuff you need to manage your sounds.