Sprite position not working in Objective C, Xcode

ساخت وبلاگ

Vote count: 0

It has been a year or so since I've used Objective C and I must have forgot something because this is stumping me. I didn't use a for loop because I wanted a delay, but I logged all these variables, r is a float, j is an integer. r and j were initialized to 0.

-(void)fire{
r = j;
if (j < 80) { j = j + 1; bullet.position = CGPointMake(2*r, 15); NSLog(@"r is %f", r); NSLog(@"j is %i", j); NSLog(@"position is %f, %f",bullet.position.x, bullet.position.y); NSLog(@"x is, %f", r/8); [self performSelector:@selector(fire) withObject:nil afterDelay:.05];
}
}

I get 80 readouts in the log and this is one of them, arbitrarily when r is 70:

r is 70.000000
j is 71
position is 0.000000, 0.000000
x is, 8.750000

So why is the position always (0,0) when I am clearly telling it to be (2*r, 15)??

asked 2 mins ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 289 تاريخ : چهارشنبه 22 ارديبهشت 1395 ساعت: 8:50