- Home /
Resizable grid of gameobjects
Hello, I'm working on a tubes puzzle game like This(Bioshock) and I wanted to create a grid that I can use to randomly instantiate tube blocks in. This is an example of the UI I'll use for the game
at the moment I'm using a plane with a mesh to display the background and the tubes squares are just flatted down cubes with a custom mesh; the lower part of the UI is not yet implemented. (No idea if this is the best way to achieve it but it works for now).
What I'm trying to create is a grid that adapts to the size of a plane (to fit different screen sizes) and in which I can instantiate tubes (which also need to adapt to the grid block size). The tubes can't be moved from a block to another, they just rotate.
The game is all in 2D and I use Javascript but any idea would be great. I don't know if Unity scales down things automatically when it detects the screen size but that's the main problem I have because the game is intended for android mobile devices. Thanks :)
Answer by lukos1986 · Oct 25, 2013 at 11:21 AM
Its quite a task, and there is no quick answer for that. Make few Tile Prefabs, Then Place them in the grid. Each tile need to talk to each other when "filling up"
Animating each tile might me an issue. You could for example animate UV offset on the pipe texture to make it look like is filling up. This will require set of tiles generated in 3d package with specific uv. Ive done this before for game for one of beer companies in uk. Here is some fbx to save you some effort. link text
This are simple 3 model of pipes with correct uv, if you apply texture and change material offset you will see how its behaving
Thanks! I haven't tought about how to make the water flowing animation yet, I'll probably make a simple 2D animation. To check if water can go through a tube to another I simply used boolean variables (true=pass, false=you shall not pass!) in a script that stores the tubes in a 2d array. The way the game works and checks if the tubes are in the right position is all done through a script. The only problem left is how to resize the game's objects according to screen resolution