|
Hello, I am trying to make a simple memory game, I got a couple of boxes you need to press however I want unity to choose the pattern (for example; It start with 1, you hit box 1 than it shows 1 and 3, you hit 1 and 3 etc etc). However how I create such thing using Array? I am fairly new to Arrays so a helping hand would be great. Thanks
(comments are locked)
|
|
Firstly, you will have an array that looks like this in C#: This will store the GameObject for each block you have to press. You can access each block by its unique index like this: Keep in mind indexes start from zero, so if you have 7 blocks, they will be indexed 0-6. Use a List to represent your "memory" chain. This allows you to add one integer at a time to the List, then get them back in order using a "foreach" loop. Using the List looks like this: ... ... Hope this helps! By the way, does anyone know how to create separate blocks for code? Thanks for the comment, will take a look into that :)
May 10 '12 at 02:35 PM
Bloodsail
(comments are locked)
|
|
Found a great tutorial that will help me a lot! Thanks to @agosyclamoth for the name of the actually game I was trying to make. It appears to have a good tutorial :). (It's in C#) http://forum.unity3d.com/threads/113371-(Free)-Full-Game-programming-tutorial-from-start-to-finish-using-Unity3D.
(comments are locked)
|

Is this like a 'simon says' game? I would use a List for this, storing the index of the boxes.
Don't be tempted to use the UnityScript 'Array' class in the Unity API. It's really not good. You have all of the .net library to play with, after all.
Yeah It is like Simon says, haha.
And what should I use instead of an Array? I am a beginner with Jc and so far what I've read on the webs they where using Arrays. (I can remember that I did something like this a while ago in Flash by using an Array :P)
Could you maybe make a little tutorial on how to make a function like this? I am kinda stuck lol.
You are not ready to make your own thing. Learn other people's things first.
@Jessy, What do you mean with your comment? :|
This is very basic stuff, and many people have tutorials covering it. You should go study the success they had, before attempting it yourself, or you'll end up wasting too much time reinventing the wheel.