klingl Posted June 28, 2016 Share Posted June 28, 2016 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 More sharing options...
klingl Posted June 28, 2016 Author Share Posted June 28, 2016 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 More sharing options...
Recommended Posts