• Content count

  • Joined

  • Last visited

  1. robotron9000

    Riot at the Wyatt

    Hey thanks for giving it a try! I just fixed a mistake I made where the 'K' key wouldn't work. You should be able to use any letter key on the keyboard to move. The top row moves to the top, middle row to the middle, and bottom row to move to the lowest position.
  2. robotron9000

    Riot at the Wyatt

    Oh no! A riot has broken out at the Wyatt Saloon, and poor Miss Dallas has only her parasol to protect herself from all the flying debris! Luckily there's quite a few smelling salts lying around the place which she can use to stop herself from fainting. Hi All, This is my first attempt with Phaser, and the first time I've ever actually seen a game making attempt through to completion. I've played around with a few other frameworks before (LOVE2D mainly), but never actually made anything playable. Needs a keyboard to play
  3. robotron9000

    Point.rotate() confusion - results not what I expect

    Thanks so much for your advice both of you. I played about with it a bit and figured it out. I was missing something very obvious. When you create a Point and rotate it, it seems it rotates around the spot it was created at. To get the behaviour I wanted, I should have been creating the point at the elbow. So my code should have been like: this.update = function(dt) { this.upper_arm.rotation += 0.4 * dt; var lower_arm_pos = new Phaser.Point(this.upper_arm.x, this.upper_arm.y); lower_arm_pos.rotate(this.upper_arm.x, this.upper_arm.y, this.upper_arm.rotation, false, this.upper_arm.width); this.lower_arm.pos = lower_arm_pos; }; Here's a simple version working like it should:
  4. Hi there. I'm new here. In the game I'm working on I've got an "arm" with an upper portion that rotates around from its shoulder, and then a second sprite that is the lower part of the arm that connects at the "elbow". I'm using Point.rotate() to find the location of the "elbow" (the end of the sprite for the upper arm), so I can set that as the spot for the anchor of the lower arm sprite I think I don't really understand how it works, because for some reason I need to subtract about 0.27 radians from the upper arm's angle in order to get the two to meet at the elbow... Why would this be? It doesn't really matter, since I have the result that I want, but I just want to know why it is. Arm = function () { =; this.upper_arm = game.add.sprite(1200, 300, 'arm_segment'); this.upper_arm.anchor = new Phaser.Point(1, 0.5); this.lower_arm = game.add.sprite(0, 0, 'arm_segment'); this.lower_arm.anchor = new Phaser.Point(1, 0.5); this.update = function(dt) { this.upper_arm.rotation += 0.4 * dt; var lower_arm_pos = new Phaser.Point(); // Angle offset needed of -0.27 to make the lower arm and upper arm meet. Why?? lower_arm_pos.rotate(this.upper_arm.x, this.upper_arm.y, this.upper_arm.rotation - 0.270, false, this.upper_arm.width); this.lower_arm.pos = lower_arm_pos; }; }; P.S. I failed high school math. Go easy on me