PDA

View Full Version : Timers in Obj-C




vodouman
Jul 10, 2011, 04:01 PM
Hi guys

Just started programming in Obj-C.

I wanted to make a Tetris style game to test my ability before I develop a unique game for sale in the App Store.

If I generated a 2d block at the top of the screen with core graphics would I be able to set a timer which will allow the user to move the block left and right but then every X amount of seconds will move the block down.

I was just worried that an attempt to implement this would result in the program pausing for X seconds and ignoring user input and would then accept input after the timer had run down.

I want a timer to trigger a move down yet still enable left and right movement.

Thanks,

- Vodouman :)



robbieduncan
Jul 10, 2011, 04:04 PM
Look at NSTimer (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html).

vodouman
Jul 10, 2011, 04:06 PM
Look at NSTimer (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html).

Ahhh perfect. Much appreciated sir :)