JcKairos

Members
  • Content count

    19
  • Joined

  • Last visited

About JcKairos

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JcKairos

    Detect the direction of dragging

    May I know how to find out whether is it dragging from the left or right?
  2. JcKairos

    Detect the direction of dragging

    Is there anyway to detect where is the player dragging? I want to give the player a warning sound once they drag the object to the limit.
  3. JcKairos

    Tween point of a graphic

    for (let i = 1; i < xPoints.length-1; i++){ a= i*2 this.game.add.tween(graphicsend.currentPath.shape._points).to({a: (225-newypoint[i]) }, 500, Phaser.Easing.Linear.None, true); } for (let i = 1; i < yPoints.length-1; i++){ b= i*2 +1 this.game.add.tween(graphicsend.currentPath.shape._points).to({b: (315-newxpoint[i]) }, 500, Phaser.Easing.Linear.None, true); } Hi, I am trying to tween the points of a graphic but I am having trouble looping it. The a and b variable I set is useless but if I set it to for (let i = 1; i < xPoints.length-1; i++){ a= i*2 this.game.add.tween(graphicsend.currentPath.shape._points).to({2: (225-newypoint[i]) }, 500, Phaser.Easing.Linear.None, true); } for (let i = 1; i < yPoints.length-1; i++){ b= i*2 +1 this.game.add.tween(graphicsend.currentPath.shape._points).to({3: (315-newxpoint[i]) }, 500, Phaser.Easing.Linear.None, true); } it works. Is there any way to represent the numbers to be tweened?
  4. I need to create a project based on a flash project, however, I can't think of a way to replicate this: I was thinking about using graphics but I do not know how to update it when dragging. Is there anyway to create this?
  5. JcKairos

    Flip of figure

    Is it possible for this kind of shapes? And may I know what does the 4 and 5 represent in this code: game.add.tween(rightG.currentPath.points).to({4: 0, 5:0}, 2500, Phaser.Easing.Linear.None, true);?
  6. JcKairos

    Flip of figure

    I am currently creating a program to teach players about symmetry but I encountered some problem This is what I want to get: The program works fine when flipping horizontally. However when it comes to diagonal: Is it possible for the figure to flip diagonally while it stays on the line of symmetry and not not fly out of it? Flip code of horizontal: this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 450}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 0.5 }, 500, Phaser.Easing.Linear.None, true); this.game.time.events.add(Phaser.Timer.SECOND * 1, function () { this.tweenTint(graphicsend, 0xffffff, 0x6666ff, 500); this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 0}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 1 }, 500, Phaser.Easing.Linear.None, true); }, this); this.game.time.events.add(Phaser.Timer.SECOND * 2.5, function () { this.tweenTint(graphicsend, 0x6666ff, 0xffffff, 500); this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 450}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 0.5 }, 500, Phaser.Easing.Linear.None, true); }, this); this.game.time.events.add(Phaser.Timer.SECOND * 3.5, function () { this.tweenTint(graphicsend, 0xffffff, 0x6666ff, 500); this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 0}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 1 }, 500, Phaser.Easing.Linear.None, true); }, this); Flip code for diagonal: this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 318}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { y: 408}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 0.5 }, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to({angle:'+90'}, 500, Phaser.Easing.Linear.None, true); this.game.time.events.add(Phaser.Timer.SECOND * 1, function () { this.tweenTint(graphicsend, 0xffffff, 0x6666ff, 500); this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 133}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { y: 220}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 1 }, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to({angle:'-90'}, 500, Phaser.Easing.Linear.None, true); }, this); this.game.time.events.add(Phaser.Timer.SECOND * 2.5, function () { this.tweenTint(graphicsend, 0x6666ff, 0xffffff, 500); this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 318}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { y: 408}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 0.5 }, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to({angle:'+90'}, 500, Phaser.Easing.Linear.None, true); }, this); this.game.time.events.add(Phaser.Timer.SECOND * 3.5, function () { this.tweenTint(graphicsend, 0xffffff, 0x6666ff, 500); this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 133}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { y: 220}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { alpha: 1 }, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to({angle:'-90'}, 500, Phaser.Easing.Linear.None, true); }, this);
  7. JcKairos

    Make Graphic into Sprite

    graphicsend = this.game.add.graphics(0, 0); graphicsend.beginFill(0xffffff); graphicsend.lineStyle(3, 0x228B22, 1); graphicsend.moveTo(startpoint.x,startpoint.y); i =1 while (i < numberoflinesdrawn+1){ graphicsend.lineTo(storedx,storedy) i++; } graphicsend.endFill(); This is my code for creating the graphic which the player have drawn, but due to the first line of this.game.add.graphics(0, 0), all axis related to the graphic became (0,0). So I do not understand how to add child since everything will just appear at 0,0.
  8. JcKairos

    Make Graphic into Sprite

    Hi, I am trying to create generate a texture for my graphic so I can use it as a sprite. However I have a problem when using the following code: sprite = game.add.sprite(400, 300, graphics.generateTexture()); as the graphic which I want to create is done by the player, so I have no idea how to set the x axis and y axis so that the generated sprite literally takes over the place of the graphic. Is there a way to add the sprite right above the graphic?
  9. JcKairos

    How to tween flip a sprite diagonally?

    Currently I am trying to get a graphic figure to flip diagonally, it is working fine when flipping horizontally and vertically using the codes: this.game.add.tween(graphicsend.scale).to( { y: graphicsend.scale.y*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { y: 630}, 500, Phaser.Easing.Linear.None, true); and this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 450}, 500, Phaser.Easing.Linear.None, true); However, I faced a problem when trying to flip it diagonally: this.game.add.tween(graphicsend.scale).to( { x: graphicsend.scale.x*-1}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { x: 540}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to( { y: 540}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(graphicsend).to({angle:'+90'}, 500, Phaser.Easing.Linear.None, true); Even though the final result is what I desired, the progress does not look good. Instead of a smooth flip like the horizontal and vertical flip, the diagonal flip just make the graphic figure move like a crescent. It does not look like a flip but instead looks like the figure have jumped from one side to the other. I am thinking that the problem is the anchor but how do you change the anchor for a graphic figure?
  10. JcKairos

    How to tween flip a sprite diagonally?

    May I have the source? Don't really understand this code. (Sorry for the late reply, was on vacation)
  11. JcKairos

    How to tween flip a sprite diagonally?

    Is there a way for it be visually flipping and not seem like it is becoming small and then large again?
  12. I know that tween flipping horizontally and vertical can be done with sprite.scale.x*-1 and sprite.scale.y*-1. I can get the result of diagonally flipping by implementing both the horizontal and vertical flipping, but it does not look like it is flipping when tween and instead just looks like it became small and larger again. Is there any way to show it flipping diagonally?
  13. JcKairos

    Dotted lines using graphic

    Solved.
  14. JcKairos

    Dotted lines using graphic

    I am creating a program which shows a graph and the user have to click on a point on the graph which will create a line from (0,0) to the clicked point, the program is working but is there any way to use game.add.graphics to create dotted lines instead of solid lines?