- Home /
Columns/Magic Jewelry remake on Unity
I wanted to create a tetris + match 3 game inside unity. Here is an example of the original game: Magic Jewelry Gameplay
I'm developing it for the mobile platforms. So far I used UI elements such as UIImage that serves as an individual blocks. I created a script that will give out random colors for the box. I then parented three blocks to an empty game object named GameObjectParent
.
For the movement, I created another script that subtracts the GameObjectParent's anchoredposition.y
every second. In terms of collision, I created a transparent UI Image that will serve as ground triggers that will stop the GameObjectParent's movement once it's entered.
My problem now is the matching of the colored blocks, and more importantly, Instantiating the GameObjectParent. I tried using out
RectTransform gRect = theCanvas.GetComponent<RectTransform>();
var groupH = Instantiate(GameObjectParent, new Vector3(0,0,0) , Quaternion.Euler(0,0,0));
groupH.transform.parent = theCanvas.transform;
groupH.transform.localScale = new Vector2(1, 1);
But it somewhat spawns out of place. I have a "startingblock" which is currently anchored on the canvas (50, 810)
- that is where the spawned blocks should start. However when I try this:
var groupH = Instantiate(GameObjectParent, new Vector2(80,810) , Quaternion.Euler(0,0,0));
The newly cloned and spawned GameObjectParent goes out of place (21392,8712398)
. I don't know what's happening. Even so, if I attach the Instantiate method on a key press, it spawns to GameObjectParents at a time, the other being slightly tilted.
I also have no idea how to match the colors of the other blocks as well. I tried searching for similar game concepts like this for unity but to no avail. There are also no tutorials/guides/pointers etc. so I really have to discover it on my own. Any thoughts about this guys? And are there any pointers, guides, or anything that you could give me?
Much appreciated!