I’ve been writing short stories here on trhs, this being the first ASK post. I’ve made 4 apps as of now and have started with the development of a game this time.
What is the game all about?
It’s a puzzle game. We are using AndEngine to build it on Android platform (currently). We have divided the game into various World, with each World containing various Levels.
(Name of game is not yet decided)
What is the Issue?
See the Game design below. The purpose of the game is to drag-and-drop the broken pieces into the “drop” area (a.k.a. holder) and form the circle. We’ve developed the basic 2 levels of the game. This is the third level. The issue is how do we know that all the broken pieces have filled the holder? We’re using AndEngine for the first time and have very little idea how this can be done.
Tapping on any broken object would rotate it by 90 degrees. So there can be 4 possible solutions for each of them).
Also, the logic should hold true for any shape, any number of broken pieces, any number of holders.
Ideas that we’ve thought about
We’ve thought to solve this using:
1) Area of the holder is filled -> But how do we programmatically do that?
2) Take center coordinates of each broken piece and find the distance from the center of the circle. Verify this in all the 4 conditions (all 4 rotations by 90 degree each). -> We’re trying to figure this out.
3) See if all the broken pieces are used in the holder area -> What if there are more than one holder?
Any technical help or any references would be really great.
Nitish Mehta
Contact me at nitish(at)illuminativeworks(dot)com I think we might able to help with codes for android
Aditya Kulkarni
If you need to check which pieces are placed in, use a boolean array of size 3 and update array when a piece is dropped inside the circle. Let the pieces correspond to the array indices i.e.0-2.
If you just care about the end result, just initiate a numeric as 0. Increment count when piece is dropped inside the circle. After each drop, check if count==3 (or whichever number you need).
Ashish Chowdhary
Aditya
I’ve written in the 3rd idea that we had that we can do using no. of pieces but what if there are more than 1 holder? Let us say we have 2 circles. Let the first circle be broken into 3 pieces and 2nd one into 5 pieces (smaller than the 3 pieces of circle 1).
Now if I put 2 CORRECT piece of circle 1 into circle 1 but a smaller piece of circle 2 into circle 1. By number count, circle 1 should be fine as it contains 3 pieces but area wise, it still isn’t done.
Hence this logic cannot work.
Ashish Chowdhary
Just saw your website. You’re based out in Ahmedabad.. Great.. Let’s meet up!!
Anyway, sent you a mail as well.
Aditya Kulkarni
Step 1: Define the parent circle for each individual piece at the start.
Step 2: Check if all pieces inside the circle have it as their parent.
Ashish Chowdhary
Aditya,
We don’t want to do that. If we do that then users would know from starting itself that how many pieces go in one holder and how many go into the other. Then there would be no difficulty in solving the puzzle.
Aditya Kulkarni
Oops…i meant code the above logic in…:)