x


Sequence Scripting

So, currently I am working on a game that uses a 3x3 grid. Like so:

1-2-3

4-5-6

7-8-9

nodes 1 through 9 are all in the off setting. each have a total of 4 colors (off, yellow, green and purple)

I am trying to write a script that allows the computer (AI) to select a sequence of the buttons that the player will have to follow within a certain amount of time from the computer finishing the sequence the colors don't matter in this situation (i just let you know of the colors showing there are multiple states for the buttons. I found some information on how to script a Simon Says game (the one with one unit and 4 color plates but that doesn't really resolve my situation let alone tell me where to even start.

Is it possible/plausible for me to write a script that will destroy the nodeOff gameObject and instantiate one of the other colors as a prefab? Is this efficient? What would be a best practice in this situation? How would I tackle this as a beginning programmer?

Thank you so much!

more ▼

asked Apr 29 '12 at 06:13 AM

mister.keith gravatar image

mister.keith
79 8 11 11

In the grid, are the elements GUI Buttons or are they Game Objects?

May 01 '12 at 02:22 AM kolban

The gird is comprised of game objects. Thanks for the clarifying question!

May 01 '12 at 03:13 PM mister.keith
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I ended up using a series of if statements and ray casts to really work the AI and then I attached it to a game manager GO. Instead of different colored blocks I also used area lights for a much better effect. I am still interested in how other people may have gone about doing this!

more ▼

answered May 25 '12 at 07:33 PM

mister.keith gravatar image

mister.keith
79 8 11 11

Thanks for coming back to answer your own question ;) I will accept your answer so it's closed ;)

May 25 '12 at 07:34 PM Bunny83
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5271
x4371
x370
x33

asked: Apr 29 '12 at 06:13 AM

Seen: 647 times

Last Updated: May 25 '12 at 07:34 PM