Hi, All:

I have an NSImageView (in a variable called ball) that I am trying to move programatically across the screen, and when it hits a wall, reposition it in the center. I've set up an NSTimer, and in the timerFireMethod have this:


        NSRect ballFrame = [ball frame];
        ballFrame.origin.x+=ballDeltaX; // move the ball
        ballFrame.origin.y+=ballDeltaY;


works just fine, the ball merrily moves across the NSView. However, when I hit the wall, and do the following:

        [myController victoryGoesTo:'R'];
        [timer invalidate];
        [self placeBallInCenter];

the placeBallInCenter method fails:

-(void)placeBallInCenter{

        [ball setFrameOrigin:NSMakePoint(125,125)];
        NSLog(@"ball frame:  %@",NSStringFromRect([ball frame]));
}

The ball's origin displays correctly in the console as (125,125), but the ball is stuck on the right hand side of the screen, at around 400.

I'm using the same technique in placeBallInCenter as I did in my timerFireMethod, so I am perplexed.

Thanks for any enlightenment,

Michael
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to