jhonatanoliveira Posted June 19, 2015 Share Posted June 19, 2015 Hello. I got stuck in a issue that maybe you guys could help me out with your experience. I am developing a puzzle game where we have few circles on the screen. The user can drag one over the other and than the two circles merge into a new one (sometimes bigger, sometimes smaller).My issue is that I don't know how to model these circles. I thought about using the Graphics library, but I want them to have animations (with spritesheet and even using particles for a merge animation), so I think I can't use Graphics (can I?).Then, I thought about using simple sprites with the spritesheet, but then the problem is with the size transformations during the game. Notice that if the user drag one circle over the other one, I will delete the two original circles and create a new one based on the size of the two original (which can make the new circle be either smaller or bigger). I'll be grateful with any suggestion or directions on this.Best regards. Link to comment Share on other sites More sharing options...
Tom Atom Posted June 25, 2015 Share Posted June 25, 2015 Hi, should be no problem. You can scale sprites with scale property. Scaling too much may blur image, so if I was at your place, I would draw circle into sprite atlas several times (let's say 3 times) and then I would choose the size which is closest to my needs. This size I would adjust with scale property to exactly needed size. For calculating sizes I would use famous: area = PI * r^2 Let's say my circle in spritesheet is 100 pixels wide ... which is 50 pixels radius. And I want onscreen circle to have area 10000 pixels. Then:1) radius of onscreen = sqrt(area / PI) = sqrt (10000 / 3.14) = sqrt(3185) = 56 (rounded)2) sprite scale = 56 (calculated radius) / 50 (sprite radius) = 1.12 ... set: myCircleSprite.scale.setTo(1.12, 1.12); Link to comment Share on other sites More sharing options...
Recommended Posts