Jump to content

Suggestion for a puzzle game with elements' size defined on the fly


jhonatanoliveira
 Share

Recommended Posts

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

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

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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