Fenopiù

Members
  • Content Count

    94
  • Joined

  • Last visited

Everything posted by Fenopiù

  1. Good morning everyone! I use a shader in my game who create a starfield and then, after a while, it slowly disappear from the center to all the screen. On every device I've tested (pc, Android, iPhone 5c, first iPad, Mac book pro, ecc...) it work as I want. In the new iPad the whole in the center, instead of be "trasparent" or "invisibile", it is total black. Anyone have a clue to solve this?
  2. I've created the button via DOM in Phaser/Typescript. In theory, you can put your function "login" wherever you want... but it have to exist BEFORE the browser see "<button onclick="login()">Log In</button>". That's why I've followed the DOM solution.
  3. Fenopiù

    Dinamic alpha

    Maybe a bitmapdata with blenddarken or blendlighten? It seems the right way but there are no examples and they seems to not work in Phaser 2.6.2... 😞
  4. Fenopiù

    Dinamic alpha

    Hi everyone! I have some sprites that goes down, I would like that when they become nearest to a point, their alpha goes down bit by bit (so not for all the sprite but just the bit who touch the alpha zone) and then disappear when they overcome that limit. I let disappear the sprite over the limit with a mask. How can I give them the dinamic (smoked) alpha too?
  5. Or you can simply create your "tweens array" and call a kill to every tween in the array except the one you want to let alive.
  6. If you put them in a group, you can destroy any child except one.
  7. Hi guys! There is a way to draw an ellipse with bitmapdata with Phaser 2.6.2? I've found out how to draw an ellipse as a Phaser.Ellipse and Phaser.Graphics.drawEllipse... but I need it as Bitmapdata where I've found just circle and rectangle. I need to draw en ellipse gradient.
  8. Good evening everyone! I'm using Typescript and Phaser 2.6.2. I've a box where sprites are rendered, outside this box they aren't. To do this I've applied e mask (drawRect). Now I've to give to the top and the bottom of this box a little shade, so the sprites that enter from the top of the box starts to be rendered in the box with alpha 0 to alpha 1 and the sprites that leaves the box from the bottom are going to alpha 1 to alpha 0 and then they will be no more rendered outside the box. How can I reach this? The only solution I've found is to put a sprite or a bitmap data on... but is not a mask and it doesn't work as I desire... :-(
  9. Same problem for multiple mask to a group (filled with sprites)?
  10. Have you tried: game.input.onDown.addOnce(this.updateText, this); or better: game.input.onDown.addOnce(function(){this.updateText()}, this); ?
  11. 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){...}
  12. 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.
  13. 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).
  14. 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.
  15. What if, instead of a full HTML page, I've to render just a <div id="bla-bla-bla">content</div> to render?
  16. 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?
  17. 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.
  18. No, it's not a drag & drop engine.
  19. Wow... that's a really big bug! O_o What Phaser version do you use?
  20. Fenopiù

    What is context

    Context is where the object "exist". game/this are most common context.
  21. 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.
  22. 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.
  23. 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.
  24. Yes, I've the same issue with your link. +/- 50px different.