Container Example - Give every Sprite a hash table!

Post your own tutorials, guides and demos.

Post » Tue Jan 20, 2009 9:02 am

Some of you may not be aware, but containers can be used on non-frame objects as well. This is great if you want to pair up a data object with another object. In the example I have attached, each of the orange balls has a hash table, and you can easily set and get the values of them. If you use a condition which picks a particular sprite, the correct hash table will automatically be picked as well, giving each individual Sprite its own hash table as though it was a part of it!

The advantage to using the hash table over normal private variables is that the hash table is dynamic. You can form the key using an expression, which allows for all sorts of dynamic data structuring :)

Hopefully this will help ya out Mipey!
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Tue Jan 20, 2009 9:18 am

Wow, didn't know that :o Sounds VERY useful!
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Tue Jan 20, 2009 11:45 am

Awesome, that is what I needed! Thank you very much, David :)

Now to implement this into a fully functional and expandable solution... Oh joy!
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests