Pong Questions:

Member
Posts: 196
Joined: 2003.10
Post: #5
well that's basically what's happening. you know, i think you're right about my key repeating thing. there's a delay between the first press and the first reaction. right now the system works just as you say, the view takes the keyboard input with the following code:

Code:
- (void)keyDown:(NSEvent *)theEvent
{
    NSString *keyChar = [theEvent charactersIgnoringModifiers];
    switch ([keyChar characterAtIndex:0])
    {
        case NSUpArrowFunctionKey:
            [PongControllerOutlet movePaddle:1];
            [self setNeedsDisplay:YES];
            return;
    case NSDownArrowFunctionKey:
            [PongControllerOutlet movePaddle:0];
            [self setNeedsDisplay:YES];
            return;
    }
}

and changes the paddle's state. oh wait. i just saw that. i don't need to redraw. d'oh! redundant post. ah well, i'll post it anyway to show how i can make silly mistakes! let me try that...
Quote this message in a reply
Post Reply 


Messages In This Thread
Pong Questions: - blobbo - Jan 19, 2004, 08:34 PM
Pong Questions: - skyhawk - Jan 19, 2004, 10:10 PM
Pong Questions: - blobbo - Jan 20, 2004, 05:48 PM
Pong Questions: - NCarter - Jan 20, 2004, 06:27 PM
Pong Questions: - blobbo - Jan 21, 2004 04:14 PM
Pong Questions: - blobbo - Jan 21, 2004, 06:08 PM
Pong Questions: - NCarter - Jan 21, 2004, 06:22 PM
Pong Questions: - skyhawk - Jan 21, 2004, 07:45 PM
Pong Questions: - blobbo - Jan 21, 2004, 08:16 PM
Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Request] Pong Source & One Question McSpider 6 6,776 Sep 18, 2011 07:21 AM
Last Post: fudog
  Pong AI trouble saxplayer13 15 7,117 Dec 16, 2005 10:40 AM
Last Post: jamil5454
  My first Cocoa Game that works! (Pong) blobbo 16 9,206 Aug 4, 2005 03:15 PM
Last Post: Andrew
  Pong "Physics" Nick 9 5,781 Sep 28, 2004 07:36 PM
Last Post: aarku
  Tic Tac Toe almost done... Next up: Pong! blobbo 15 7,144 Jan 16, 2004 06:33 PM
Last Post: blobbo