Jump to content



Recommended Posts

Hey guys,

I'm new to Phaser and I want to build a pendulum in my game.  My problem:

The Pendulum should have some kind of perspective. What I want I think is a mix between a change of the angle and the scale. But I'm really stuck right now and I tried different approaches. My Pendulum has got 3 different parts, so I tried the rope class too.

I've now created the movement from the pendulum and i would like to replace a simple line with a sprite. Is there a simple way to do this? Or to have a sprite filling the space between 2 objects.

Thank you!

Link to comment
Share on other sites

If I use a single sprite and rotate it, I can't get the movement like an ellipse... Look at the following code snippet, I need help at the scale lines.


    if(pendel.angle <= - (angle)) {
        direction = false;
    if(pendel.angle >= angle) {
        direction = true;

    if(direction) {
        pendel.angle -= speed;
        pendel.scale.setTo(1, (1 + Math.abs(pendel.angle) * 0.001) );
    } else {
        pendel.angle += speed;
        pendel.scale.setTo(1, (1 + Math.abs(pendel.angle) * 0.001) );

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...