Jump to content

XekeDeath

Members
  • Posts

    320
  • Joined

  • Last visited

  • Days Won

    3

XekeDeath last won the day on December 27 2014

XekeDeath had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Australia

Recent Profile Visitors

2,478 profile views

XekeDeath's Achievements

  1. You want this property on the images input handler: http://phaser.io/docs/2.6.2/Phaser.InputHandler.html#pixelPerfectClick Setting that to true will only register clicks that are over areas of the image that have an alpha value on and above the pixelPerfectAlpha threshold. http://phaser.io/docs/2.6.2/Phaser.InputHandler.html#pixelPerfectAlpha
  2. Make sure the x and y values of the text are integer values... This aligns them to the pixel grid... If either value is not an integer value, it won't be properly aligned, and the rendering will be blurry as it tries to be half way across a pixel...
  3. Open the image in an editor and rotate it there...
  4. The only time I have come across blurry fonts is when they have a off-pixel position... When you are redrawing the element, are you ensuring the text field it pixel aligned..?
  5. When you are creating your baddies, you are assigning them all to the same variable... This is overwriting which baddie it is pointing to, so when you get to your Direction function, the variable is pointing at the last one you created... I see you are creating them with the baddies group... You can look into the forEach functions that a group has to loop over the baddies and call Direction on each of them...
  6. Generally, the X/Y of the object is used for calculations... Looking at the source code for this function, it is the X/Y of the object... Changing the anchor doesn't matter to the calculation at all... https://github.com/photonstorm/phaser/blob/v2.6.2/src/physics/arcade/World.js#L1918 You can also use game.math.distance to get the distance between two points... It takes the individual coordinates instead of the whole object as arguments... http://phaser.io/docs/2.6.2/Phaser.Math.html#distance How do you mean "distance between a point and a whole sprite"..? Do you want a collection of distances for each pixel the sprite is taking up, or just the X/Y...?
  7. If all you want is rendering, look at Pixi.js... Phaser 2 is a game engine, built with classes and ideas suited for building a game, and it is built on top of Pixi.js. Phaser 3 will not be using Pixi, but its own from scratch rendering engine... If you want to stick with Phaser, it already has the ability to customise your build, removing the elements you don't want... https://phaser.io/tutorials/creating-custom-phaser-builds
  8. When you are creating a slime, you are assigning it to this.slime... When you collide with ANY slime, this.slime is the one you are killing... It might be the right one, it might not be... (slime.body.touching.up){ this.player.body.velocity.y = -300; this.slime.play('slimeDead'); // THIS LINE HERE... this.game.time.events.add(Phaser.Timer.SECOND * 1, this.killEnemy, this); } Remove this. before slime, and see what happens...
  9. It is because you are creating new objects over the top of the previous ones, not reusing the same object. In create, assign your coinText to a single instance of the bitmapText, and in the update, change the coinText.text property.
  10. After a very quick glance, I would say change overlayer_group.addChild(layer); to overlayer_group.add(layer);
  11. // Enable input on the button... this.rePlay.inputEnabled = true; // Attach a function to the input down ( click/tap) this.rePlay.events.onInputDown.add(function() { this.game.state.start('name of the current state'); }, this);
  12. You are adding new callbacks each time squirrelThrowNut is called, and the old ones are still there... addOnce, as drhayes suggests will fix this for you, as the callback is removed when it is called.
  13. You'll want these things: Image/Sprite for the buttons... Image/Sprite input enabled to make the button clickable... Image/Sprite.events to find the interaction you want, and what the callback will receive... Phaser.Text for the text to tell them if they are right or wrong. For the answers part, you will need something to track your questions and assign an answer to each button... When the button is pressed, check the answer that you assigned it in the callback to see if they are correct, and adjust the text accordingly... Without writing it for you, that should be enough to get you going... The docs are very helpful...
  14. Try putting a breakpoint in the stop moving function and see what 'this' actually is... I have a suspicion that it won't be the ball object that you think it is, but the playstate object instead... The last argument sent to the overlap function is the callback context, meaning the object that "this" points to inside the callback function... There are several things you can do here: - Change the callback context to be the ball you are testing against. - Move the callback function to the playstate object, and use this.ball.body.velocity instead. Or, the one I would recommend, - Change the callback function to one on the playstate object, and make use of the parameters sent to the callback function... From the docs: update: function() { game.physics.arcade.overlap(this.ball, this.player2, this.collisionCallback, null, this); }, playstate = { // Your code collisionCallback: function(ball, player) { ball.stopMoving(); } }
  15. This is because you are creating new texts every time... They are not replacing the old ones, they are brand new objects, added to the stage on top of the old objects... You want to use this.game.add.text once, save the reference, then set the text value each time you want it to change... create:function() { // Your code this.gameMessage = this.game.add.text(this.game.world.width*0,this.game.world.height*0.75,"input text",this.style); } validateInput:function() { if(this.input.value=='') { this.gameMessage.text = "input text"; } else { if (this.input.value !== this.currRid.answer) { this.gameMessage.text = "you are wrong"; this.ridFactory(); } else { this.gameMessage.text = "you are correct"; } this.ridFactory(); } }
×
×
  • Create New...