vendredi 5 décembre 2014

Matching property value in an array for a Tetris clone


Vote count:

0




For my Tetris clone, I have a 2D array of GameObject for each possible coordinate on the play field (200 objects, 10 rows by 20 columns). I also have a function to generate Tetronimo blocks; which basically returns a generic List of Vector3 coordinates outlining the block position.


Rendering is disabled upon play field generation and the idea is that rendering is enabled in the 2D array only for coordinates that correspond to the returned List of Vector3 coordinates. The blocks already exist on the screen but they are not rendered until the List is returned.


Is there an easy way to link the returned coordinates with the corresponding GameObject objects on the play field? With my current implementation, I'm basically using a nested for loop to find the coordinate, and they are all contained in a foreach loop to iterate all Vector3 coordinates in the List. I was wondering if there was a better way of implementing this. Or is this the wrong way to approach Tetris?



asked 2 mins ago

geft

98






Matching property value in an array for a Tetris clone

Aucun commentaire:

Enregistrer un commentaire