I'm learning Cocoa/Objective-C/iPhone SDK, and as a simple project to apply what I've learned, I wanted to create a simple version of the Simon game of old. Four colored buttons, you're shown a sequence (Red, Green, Blue, Red, etc.) and you have to repeat the sequence back.
I believe I have most of it figured out, save one piece: showing the sequence to the user. Specifically, how to implement the delay between highlighting the button & setting it back to normal after 200ms.
If I sleep in the main run loop, the update doesn't happen properly (even if I explicitly call setNeedsDisplay
). If I spawn off a new thread, things get complicated quickly as my class method needs to refer back to UI elements (instant variables).
Any advice?