I assume you already check this very basic intro to array and hash? It was quite helpful for me
Yes, I've watched that one, thanks.
Hi,
the best way to tackle arrays and hashtable is to start with no real purpose but just understand what that do.
In your case you should have already a mechanism that knows all the squares for a given piece right? I would assum each square is parented to the piece probably, so what you can do is that when a square is touching the ground, you send a event to its parent, and the parent is then responsible to destroying all it's squares ( including the one that fired the event)
does that make sense? I am not sure you need array and hashtables for this really.
Bye,
Jean
Hi Jean, I didn't really have a game idea in mind. I just wanted to teach myself how Arrays/Hashtables work in Unity/PM.
The idea was, how do I track object position in a grid using an Array and then use that array data to destroy the object at a specific position? That is all I'm trying to do really.
Are you saying an Array is a bad way to do this? Should I just use Game Object triggers and Bools? Then a manager to track which Bools are in a line?
Hi,
in the Tetris sample it actually does not record the position but it does add the objects to the list
You can find this on the prefab items (resources/Prefab)
in the add to array state it is adding each child object from the item in the right line(array)
On the 'Game Mangager' in the 'check row' state i just the amount(count) of the objects in each line (array) when there are 10, the line gets destroyed later.
This setup i made is quite intermediate usage, maybe you should look first into some simpler samples / tutorials.
You can find several tutorials on the user tutorial wiki page
Thanks, that makes a bit more sense about what is happening.
I tried to 'reverse engineer' your Tetris example but it's quite a hard thing to do in PM.
I think I've watched most of the PM Array tutorials available now. Maybe it was just a bad way to do what I planned?