flowabuse Posted February 10, 2015 Share Posted February 10, 2015 How can I add physics to a object like this :http://jsfiddle.net/f6tf8ue9/17/ ? I am trying to make a breakout game and i want to use an arc that moves and scales in a circular manner ( exactly like the progress bar in the link) , that would be my paddle that would not allow a ball to reach the center. Can this even be done? Link to comment Share on other sites More sharing options...
flowabuse Posted February 11, 2015 Author Share Posted February 11, 2015 bump Link to comment Share on other sites More sharing options...
flowabuse Posted February 15, 2015 Author Share Posted February 15, 2015 bump Link to comment Share on other sites More sharing options...
Triplanetary Posted February 15, 2015 Share Posted February 15, 2015 Physics bodies can only be applied to sprites. The arc in the fiddle is a bitmapdata. However, bitmapdata can be used as a sprite's texture. This is done by specifying the bitmapdata's key when you create the sprite, same as any other kind of sprite texture. So you should try creating the paddle as a sprite with the bitmapdata arc as its texture. Link to comment Share on other sites More sharing options...
Triplanetary Posted February 15, 2015 Share Posted February 15, 2015 I decided to test out what I said. Turned out to be easy in this case, because I looked at the fiddle you provided again and noticed that PieProgress extends the Sprite class, so it turned out they'd already beaten me to the whole "apply bitmapdata to sprite" idea. So I tried enabling physics and applying gravity to the circle, and it works fine. The radius continues to update properly when you adjust it, but the other properties don't work anymore. I'm sure it's fixable. Check it out here: http://jsfiddle.net/f6tf8ue9/18/ (check the "create" function for the code I added). Link to comment Share on other sites More sharing options...
flowabuse Posted February 18, 2015 Author Share Posted February 18, 2015 The problem is I want the physics body shape to be the same as the 'pie' object, and to modify it using the 'progress'. So a rectangle or a circle body won't work for me. Link to comment Share on other sites More sharing options...
Recommended Posts