nduhu Posted May 22, 2014 Share Posted May 22, 2014 can you solve my problem? Link to comment Share on other sites More sharing options...
rich Posted May 22, 2014 Share Posted May 22, 2014 Maybe if there was a question attached to it. OpherV and ceb 2 Link to comment Share on other sites More sharing options...
nduhu Posted May 23, 2014 Author Share Posted May 23, 2014 i want to p1 using image not point, and have some images not just p1 maybe p3 and p4 , p2 be a central rotating, can you help me ? var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'try-rotate', {create: create, update: update, render: render });var p1;var p2;var d = 0;function create() {p1 = new Phaser.Point(200, 300);p2 = new Phaser.Point(300, 300);}function update() {p1.rotate(p2.x, p2.y, game.math.wrapAngle(d), true);d++;}function render() {game.context.fillStyle = 'rgb(255,255,0)';game.context.fillRect(p1.x, p1.y, 4, 4);game.context.fillStyle = 'rgb(255,0,0)';game.context.fillRect(p2.x, p2.y, 4, 4);} Link to comment Share on other sites More sharing options...
Heppell08 Posted May 23, 2014 Share Posted May 23, 2014 If I'm right you mean you want images? Have you checked the examples? Tutorials?You can add images and rotate that in your update. You can get images to follow points in the update by setting x/y values as the points values.Still a very open and undescriptive question so I'm guessing what you 'might' mean. Link to comment Share on other sites More sharing options...
XekeDeath Posted May 23, 2014 Share Posted May 23, 2014 Create the point objects in the update function, rotate them, and assign the x/y to the image afterwards:function update(){ var p = new Phaser.Point(img.x, img.y); p.rotate(p2.x, p2.y, game.math.wrapAngle(d), true); img.x = p.x; img.y = p.y; d++;} Link to comment Share on other sites More sharing options...
nduhu Posted May 23, 2014 Author Share Posted May 23, 2014 ok thankyou heppel and xekedeath, and 1 quetion again, how if i want to rotate 2 or more image ? i want to rotate the little circle around the big circle like this pic : http://www.inipic.com/show-image.php?id=6031c179cf6bda16cf4e321873b5afe1 Link to comment Share on other sites More sharing options...
XekeDeath Posted May 24, 2014 Share Posted May 24, 2014 Just create multiple images and apply the same code to each of them.. Store a reference to each image in an array and iterate over them, or put them in a Phaser.Group and use the forEach function to make it easier for yourself. Link to comment Share on other sites More sharing options...
nduhu Posted May 25, 2014 Author Share Posted May 25, 2014 i already do that but a have trouble in give position for every object, i dont know why, if i'm not rotate the images,images in right position but if i rotate bamm images position is untidy, can you solved my problem? Link to comment Share on other sites More sharing options...
PAEz Posted May 25, 2014 Share Posted May 25, 2014 Im not going to answer this but just wanted to say....Your getting into the realms of "code this for me"....I hate that crap.If you want people to try and "fix" your code, not "write" it, then show us some code!!!!Create a simple example in JsBin or CodeIo of woteva and then people like me would be perfectly happy to fix it. @XekeDeath : Love the sig Got a mate who created a career as a coder using that advice....being an Aussie I wonder if he taught you Heppell08 1 Link to comment Share on other sites More sharing options...
Heppell08 Posted May 25, 2014 Share Posted May 25, 2014 Positioning sprites is exactly how Xekedeath told you do it. If you want orbiting points and images to boot then do it like that. I done a small example a while ago when playing with point data. Have a look and that should help you. https://dl.dropboxusercontent.com/u/257829727/pointdata/index.html The planets are all following a rotating point and all i did was pass the X/Y to the image to stick with the rotating point data. Link to comment Share on other sites More sharing options...
nduhu Posted May 26, 2014 Author Share Posted May 26, 2014 thank you All ... Link to comment Share on other sites More sharing options...
Recommended Posts