|
View Poll Results: Was this thread helpful to other than me?? (LeopardDevX)
|
|
Yes, it helped me to!!
|
  
|
4 |
57.14% |
|
No, it was a waste of space in the forum......
|
  
|
3 |
42.86% |
 |
|
 |
|
 |
03-25-2009, 09:00 AM
|
#1 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
Resetting?? (Newb)
I have made a game where a ball is bouncing around and to not loose you move a paddle at the bottom of the screen,, and i have bricks to hit at the top of the screen.....
the game is working just fine....
but when i loose it pops up a uialertview and i have connected the buttons in the alert to actions.. i have a MainMenu button that takes you to MainView (which is a homemade viewcontroller)... and my other button is a retry button....,, but i dont know how to restart the level (view)...
Anybody can help??
Or post some code??
Thanks....
__________________
Thank You.
|
|
|
03-25-2009, 12:55 PM
|
#2 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
I have made a game where a ball is bouncing around and to not loose you move a paddle at the bottom of the screen,, and i have bricks to hit at the top of the screen.....
the game is working just fine....
but when i loose it pops up a uialertview and i have connected the buttons in the alert to actions.. i have a MainMenu button that takes you to MainView (which is a homemade viewcontroller)... and my other button is a retry button....,, but i dont know how to restart the level (view)...
Anybody can help??
Or post some code??
Thanks....
|
It's going to depend a lot on how you built your game. I assume when you first start the game, you have code that puts all of the blocks on the screen, puts the ball and paddle into position, and sets the score to zero?
If you put all of that code into a method called, lets say, "resetGame" , then you can use that method twice - once when you start the game, and again when they click replay.
Is there something in particular you need help resetting, like removing subviews you've added?
__________________
|
|
|
03-25-2009, 01:57 PM
|
#3 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
Thanks..
Quote:
Originally Posted by smasher
It's going to depend a lot on how you built your game. I assume when you first start the game, you have code that puts all of the blocks on the screen, puts the ball and paddle into position, and sets the score to zero?
If you put all of that code into a method called, lets say, "resetGame" , then you can use that method twice - once when you start the game, and again when they click replay.
Is there something in particular you need help resetting, like removing subviews you've added?
|
Thanks for reply...
I have no problem removing or adding subviews....
I tried it because i have a method to start the game....,, but i have placed the bricks with IB.
so the removed bricks doesnt pop up again.....
Isnt there an easier way to restart a view/level??
Regards...
__________________
Thank You.
Last edited by LeopardDevX; 03-25-2009 at 02:04 PM.
|
|
|
03-25-2009, 04:17 PM
|
#4 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
Thanks for reply...
I have no problem removing or adding subviews....
I tried it because i have a method to start the game....,, but i have placed the bricks with IB.
so the removed bricks doesnt pop up again.....
Isnt there an easier way to restart a view/level??
Regards... 
|
I can think of two options - as you remove the bricks from the view, put them in an array for safekeeping. Then add them back to the view when you reset.
I don't know of a way to "reset" views loaded from a nib without reloading the nib.
If the view is in a nib all by itself, you can re-create the view and its controller with something like:
Code:
ChatViewController *chatViewController = [[ChatViewController alloc] initWithNibName:@"chatView" bundle:nil];
That would create a ChatViewController, load the "chatView.nib" , and connect the File'sOwner to the ChatViewController.
If you're just using mainWindow.xib and letting it load automatically, that may be difficult; it expects File's Owner to be the app delegate, and I don't think you can re-create that.
__________________
|
|
|
03-25-2009, 04:24 PM
|
#5 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
...
Quote:
Originally Posted by smasher
I can think of two options - as you remove the bricks from the view, put them in an array for safekeeping. Then add them back to the view when you reset.
I don't know of a way to "reset" views loaded from a nib without reloading the nib.
If the view is in a nib all by itself, you can re-create the view and its controller with something like:
Code:
ChatViewController *chatViewController = [[ChatViewController alloc] initWithNibName:@"chatView" bundle:nil];
That would create a ChatViewController, load the "chatView.nib" , and connect the File'sOwner to the ChatViewController.
If you're just using mainWindow.xib and letting it load automatically, that may be difficult; it expects File's Owner to be the app delegate, and I don't think you can re-create that.
|
I`m using mainWindow.xib as my nibfile, but instead of using a viewcontroller, i`m just using a view as my top on the "View Tree" and i`m adding subViews from that view and removing them from the views.
So this safeKeeping array how does that work..?
Will they keep the position i gave them in the Interface Builder?
__________________
Thank You.
|
|
|
03-25-2009, 05:15 PM
|
#6 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
I`m using mainWindow.xib as my nibfile, but instead of using a viewcontroller, i`m just using a view as my top on the "View Tree" and i`m adding subViews from that view and removing them from the views.
So this safeKeeping array how does that work..?
Will they keep the position i gave them in the Interface Builder?
|
They should keep the last position they had - the center and frame are both properties of the UIView object you're saving. I haven't tried this - it's just an idea - so back up your project before starting this.
Code:
//safeKeeping should be an NSMutableArray
//when you want to save the views
[safeKeeping addObject: myBlock];
[myBlock removeFromSuperview];
//loop through the views you want to put back
for (UIView *myBlock in safeKeeping){
[topView addSubview: myBlock];
}
//clean out the array
[safeKeeping removeAllObjects];
__________________
|
|
|
03-26-2009, 11:00 AM
|
#7 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
so..
Quote:
Originally Posted by smasher
They should keep the last position they had - the center and frame are both properties of the UIView object you're saving. I haven't tried this - it's just an idea - so back up your project before starting this.
Code:
//safeKeeping should be an NSMutableArray
//when you want to save the views
[safeKeeping addObject: myBlock];
[myBlock removeFromSuperview];
//loop through the views you want to put back
for (UIView *myBlock in safeKeeping){
[topView addSubview: myBlock];
}
//clean out the array
[safeKeeping removeAllObjects];
|
The for (UIView *myBlock in safeKeeping).....
method isnt working...
im getting a warning on myBlock.....

__________________
Thank You.
|
|
|
03-26-2009, 12:40 PM
|
#8 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
What if..
What if i had a game where i wanted to pop up enemies from a array called "enemies" and the image is named "enemy", if i wanted them to pop up randomly on the "x" axe with the width of the view.
How should i set that up?
That would really help me understanding NSMutableArrays...

Regards..
__________________
Thank You.
|
|
|
03-26-2009, 03:24 PM
|
#9 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
What if i had a game where i wanted to pop up enemies from a array called "enemies" and the image is named "enemy", if i wanted them to pop up randomly on the "x" axe with the width of the view.
How should i set that up?
That would really help me understanding NSMutableArrays
|
Here's code to do something similar - it will put 10 copies of the same image on the screen, and put them in an array so you can get to them later. This code would work in viewDidLoad of a viewController, for example.
Code:
//declare the array in the .h file if you want to accessible
//from all methods.
NSMutableArray *arrayOfBalls
//create the array
arrayOfBalls = [[NSMutableArray alloc] init];
UIImage *ballImage = [UIImage imageNamed:@"ball.png"];
for (int i=0; i<10 ; i++){
UIImageView *newBall = [[UIImageView alloc] initWithImage: ballImage];
//set X and Y of the new imageView
newBall.center = CGPointMake(100 + i*10, 100+ i*10);
//add to array
[arrayOfBalls addObject:newBall];
//add to the view, so it gets displayed.
[self.view addSubview: newBall];
}
Quote:
The for (UIView *myBlock in safeKeeping).....
method isnt working...
im getting a warning on myBlock.....
|
Not sure why - the syntax is fine. You might get a warning if you already have a variable called myBlock; when you make two variables with the same name in different scopes, the local one hides the gobal one.
__________________
|
|
|
03-26-2009, 04:45 PM
|
#10 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
but...
Quote:
Originally Posted by smasher
Here's code to do something similar - it will put 10 copies of the same image on the screen, and put them in an array so you can get to them later. This code would work in viewDidLoad of a viewController, for example.
Code:
//declare the array in the .h file if you want to accessible
//from all methods.
NSMutableArray *arrayOfBalls
//create the array
arrayOfBalls = [[NSMutableArray alloc] init];
UIImage *ballImage = [UIImage imageNamed:@"ball.png"];
for (int i=0; i<10 ; i++){
UIImageView *newBall = [[UIImageView alloc] initWithImage: ballImage];
//set X and Y of the new imageView
newBall.center = CGPointMake(100 + i*10, 100+ i*10);
//add to array
[arrayOfBalls addObject:newBall];
//add to the view, so it gets displayed.
[self.view addSubview: newBall];
}
Not sure why - the syntax is fine. You might get a warning if you already have a variable called myBlock; when you make two variables with the same name in different scopes, the local one hides the gobal one.
|
,But if i already have a array of enemies do i need another one?
My array of enemies contains uiimageview of a enemy that i added to the array when the game starts and i have a timer to move the enemy, a timer to call spawnenemy method and a timer to keep score...
And i need to spawn enemies randomly in the x axe (i only need one type of enemy that i have added to the array)... how can this be done??
And how can i increase a timers intervals in a void?? that is being called some time.....
Thanks for all current replies and future... 
__________________
Thank You.
Last edited by LeopardDevX; 03-26-2009 at 04:48 PM.
|
|
|
03-26-2009, 04:58 PM
|
#11 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
,But if i already have a array of enemies do i need another one?
|
No, I didn't know you already had an array - I thought you needed the code.
Quote:
|
My array of enemies contains uiimageview of a enemy that i added to the array when the game starts and i have a timer to move the enemy, a timer to call spawnenemy method and a timer to keep score...
|
You probably only need one timer, calling method like "gameUpdate" - that method could call the other methods that move, spawn, and score. Otherwise you may find your operations happening in the wrong order.
Quote:
|
And i need to spawn enemies randomly in the x axe (i only need one type of enemy that i have added to the array)... how can this be done??
|
If you have the code to spawn enemies, you just need to use a random number for the x position. Like this:
Code:
int randomX = arc4random() % 320; // number from 0 to 319
newEnemy.center = CGPointMake( randomX, 150);
Quote:
And how can i increase a timers intervals in a void?? that is being called some time.....
Thanks for all current replies and future...
|
I don't understand this question, can you rephrase it? I don't know what "in a void" means.
__________________
|
|
|
03-26-2009, 05:09 PM
|
#12 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
ok..
Quote:
Originally Posted by smasher
No, I didn't know you already had an array - I thought you needed the code.
You probably only need one timer, calling method like "gameUpdate" - that method could call the other methods that move, spawn, and score. Otherwise you may find your operations happening in the wrong order.
If you have the code to spawn enemies, you just need to use a random number for the x position. Like this:
Code:
int randomX = arc4random() % 320; // number from 0 to 319
newEnemy.center = CGPointMake( randomX, 150);
I don't understand this question, can you rephrase it? I don't know what "in a void" means.
|
I`m really sorry for dum questions...
,but by "in a void" i mean in a method...
And i dont have the code to spawn a enemy..
Thanks for the arc for random code i will use that.. when i know how to spawn enemies.....
And what is the newEnemy is that reffered to "spawnedEnemy" or what is it for?
Thanks...
Sorry im a newb....
And you have helped me alot.... 
__________________
Thank You.
|
|
|
03-26-2009, 06:04 PM
|
#13 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
I`m really sorry for dum questions...
,but by "in a void" i mean in a method...
And i dont have the code to spawn a enemy..
Thanks for the arc for random code i will use that.. when i know how to spawn enemies.....
And what is the newEnemy is that reffered to "spawnedEnemy" or what is it for?
Thanks...
Sorry im a newb....
And you have helped me alot....  
|
No problem. You usually start the timer once, with an interval like 30 times a second. It's unusual to change the timer interval during the games.
Code:
timer = [NSTimer scheduledTimerWithTimeInterval: 0.033f
target: self
selector: @selector(handleTimer:)
userInfo: nil
repeats: YES];
If you want to change the interval later, you have to call [timer invalidate] and create a new timer. You should probably good for a timer example to get all the code for starting/stopping a timer.
The code I gave above spawns 10 balls on the screen - you could use it to spawn enemies too.
__________________
|
|
|
03-27-2009, 01:27 PM
|
#14 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
Hm..
Hm..
I dont know how to use the spawn code if a have a UIIMageView named enemy and want a new enemy to pop up every 4. second...
I already have a timer to call a method called spawnE, and the only thing i need is the code to pop up a new enemy...
PS: i already have a array called enemies and i have added object enemy...
So how can i do this without creating things like newEnemy and other stuff..
THings i have:
NSMutableArray *enemies;
UIImageView *enemy;
and a timer to call method:
-(void)spawnE;
so...
__________________
Thank You.
|
|
|
03-27-2009, 01:51 PM
|
#15 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
Hm..
I dont know how to use the spawn code if a have a UIIMageView named enemy and want a new enemy to pop up every 4. second...
I already have a timer to call a method called spawnE, and the only thing i need is the code to pop up a new enemy...
|
Same as the ball code above, except you don't need the loop if you're only creating one enemy. There's no way to "copy" the existing enemy, that I know of.
Code:
//spawn a new enemy, and add to the array:
UIImage *enemyImage = [UIImage imageNamed:@"enemy.png"];
UIImageView *newEnemy = [[UIImageView alloc] initWithImage: enemyImage];
//set X and Y of the new imageView
newEnemy.center = CGPointMake(150, 150);
//add to array
[enemies addObject:newEnemy];
//add to the view, so it gets displayed.
[self.view addSubview: newEnemy];
__________________
|
|
|
03-27-2009, 02:23 PM
|
#16 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
Warnings!
Quote:
Originally Posted by smasher
Same as the ball code above, except you don't need the loop if you're only creating one enemy. There's no way to "copy" the existing enemy, that I know of.
Code:
//spawn a new enemy, and add to the array:
UIImage *enemyImage = [UIImage imageNamed:@"enemy.png"];
UIImageView *newEnemy = [[UIImageView alloc] initWithImage: enemyImage];
//set X and Y of the new imageView
newEnemy.center = CGPointMake(150, 150);
//add to array
[enemies addObject:newEnemy];
//add to the view, so it gets displayed.
[self.view addSubview: newEnemy];
|
Code:
//spawn a new enemy, and add to the array:
UIImage *enemyImage = [UIImage imageNamed:@"enemy.png"];
UIImageView *newEnemy = [[UIImageView alloc] initWithImage: enemyImage];
Here Warning: warning: local decleration of "newEnemy" hides instance variable.
//set X and Y of the new imageView
newEnemy.center = CGPointMake(150, 150);
//add to array
[enemies addObject:newEnemy];
Here Warning: warning: local decleration of "newEnemy" hides instance variable.
//add to the view, so it gets displayed.
[self addSubview: newEnemy];
Here Warning: warning: local decleration of "newEnemy" hides instance variable.
 What to do?
__________________
Thank You.
|
|
|
03-27-2009, 02:29 PM
|
#17 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
Never Mind..
But.....
I cant get the newEnemy to move after its spawned.....
So how??
Thank you so much it all makes perfect sense to me now...
__________________
Thank You.
Last edited by LeopardDevX; 03-27-2009 at 02:38 PM.
Reason: ?
|
|
|
03-27-2009, 04:00 PM
|
#18 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
But.....
I cant get the newEnemy to move after its spawned.....
So how??
Thank you so much it all makes perfect sense to me now...
|
You probably have a moveEnemy method that is called every frame? That method now needs to look through the array of enemies, and move them all. That's what the array is for. This will loop through every enemy in the array, and move each one down and to the right:
Quote:
for (UIView *anEnemy in enemies){
int newX = anEnemy.center.x +5;
int newY = anEnemy.center.y +5;
anEnemy.center = CGPointMake(newX, newY);
}
|
__________________
Last edited by smasher; 03-27-2009 at 08:34 PM.
|
|
|
03-27-2009, 04:20 PM
|
#19 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
How??
Quote:
Originally Posted by smasher
You probably have a moveEnemy method that is called every frame? That method now needs to look through the array of enemies, and move them all. That's what the array is for. This will loop through every enemy in the array, and move each one down and to the right:
|
I dont get this method.. what is anEnemy and i allready have a speedY float that controlls enemy movement.....
The enemy is just moving down the Y axe,
so can you explain??
And those warnings.. i told you about what about Them???

__________________
Thank You.
|
|
|
03-27-2009, 05:17 PM
|
#20 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
I dont get this method.. what is anEnemy and i allready have a speedY float that controlls enemy movement.....
The enemy is just moving down the Y axe,
so can you explain??
And those warnings.. i told you about what about Them???
 
|
I can't see your code, so I don't know what variables you have  If you have a speedY variable, then you can use that to get the new position of the enemy.
So, this code will loop through every enemy in the array, and move them all down the screen by "speedY" :
Code:
for (UIView *anEnemy in enemies){
float newX = anEnemy.center.x;
float newY = anEnemy.center.y +speedY;
anEnemy.center = CGPointMake(newX, newY);
}
"anEnemy" is just a pointer I use when looking through the array of enemies. It's not a new object or anything, it's just used to point to the existing enemies in the array. We need a pointer so we can give everyone in the array a new position.
Code:
warning: local deceleration of "newEnemy" hides instance variable.
This means that you already have a variable (instance variable) called "newEnemy."
The compiler is complaining that I declared a new variable (local variable) with the same name. There are two ways to fix it -
(1) remove "UIImageView *" from the front of that line, so it doesn't declare a new variable. It will just use the existing variable instead.
or (2) change the name of the local variable (the new one declared on that line.) That will leave the
The correct step to take depends on what your code is doing. Are you trying to affect the instance variable, or just a local one? In my examples, changing the name of the local variable should do the trick (option 2).
__________________
Last edited by smasher; 03-27-2009 at 08:34 PM.
|
|
|
03-27-2009, 05:24 PM
|
#21 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
but...
Quote:
Originally Posted by smasher
I can't see your code, so I don't know what variables you have  If you have a speedY variable, then you can use that to get the new position of the enemy.
So, this code will loop through every enemy in the array, and move them all down the screen by "speedY" :
Code:
for (UIView *anEnemy in enemies){
float newX = anEnemy.center.x;
float newY = anEnemy.center.y +speedY;
anEnemy.center = CGMakePoint(newX, newY);
}
"anEnemy" is just a pointer I use when looking through the array of enemies. It's not a new object or anything, it's just used to point to the existing enemies in the array. We need a pointer so we can give everyone in the array a new position.
Code:
warning: local deceleration of "newEnemy" hides instance variable.
This means that you already have a variable (instance variable) called "newEnemy."
The compiler is complaining that I declared a new variable (local variable) with the same name. There are two ways to fix it -
(1) remove "UIImageView *" from the front of that line, so it doesn't declare a new variable. It will just use the existing variable instead.
or (2) change the name of the local variable (the new one declared on that line.) That will leave the
The correct step to take depends on what your code is doing. Are you trying to affect the instance variable, or just a local one? In my examples, changing the name of the local variable should do the trick (option 2).
|
but how does that make the newEnemy move.... because currently it doesnt.... 
__________________
Thank You.
|
|
|
03-27-2009, 05:28 PM
|
#22 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
|
It makes everyone in the array "enemies" move by changing their center. Are you sure that your newEnemy is in "enemies?"
Post the code where you create (init/alloc) "enemies" , and where you add your newEnemy to "enemies" .
__________________
|
|
|
03-27-2009, 05:32 PM
|
#23 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
Ok...
Quote:
Originally Posted by smasher
It makes everyone in the array "enemies" move by changing their center. Are you sure that your newEnemy is in "enemies?"
Post the code where you create (init/alloc) "enemies" , and where you add your newEnemy to "enemies" .
|
Code:
//Here is the spawnE...
-(void)spawnE {
UIImage *enemyImage = [UIImage imageNamed:@"enemy.png"];
UIImageView *newEnemy = [[UIImageView alloc] initWithImage: enemyImage];
int randomX = arc4random() % 320; // number from 0 to 319
newEnemy.center = CGPointMake( randomX, 0);
[enemies addObject:newEnemy];
[self addSubview: newEnemy];
}
/* and here is.. the complete move method with my enemy and my newEnemy
move code.
/*
-(void)move {
for (UIView *anEnemy in enemies){
float newX = anEnemy.center.x;
float newY = anEnemy.center.y + speedY;
anEnemy.center = CGPointMake(newX, newY);
}
CGPoint centerr = enemy.center;
centerr.y += speedY;
enemy.center = centerr;
if (centerr.y > 470){
[enemy removeFromSuperview];
}
if (CGRectIntersectsRect(enemy.frame, survivor.frame)) {
[survivor removeFromSuperview];
[self loose];
}
if (CGRectIntersectsRect(newEnemy.frame, survivor.frame)) {
[survivor removeFromSuperview];
[self loose];
}
}
The spawn code works perfectly...but the move
__________________
Thank You.
|
|
|
03-27-2009, 05:42 PM
|
#24 (permalink)
|
|
Senior Member
iPhone Dev SDK Supporter
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,547
|
Quote:
Originally Posted by LeopardDevX
The spawn code works perfectly...but the move 
|
Post the code where you create the array "enemies" . There should be a line like this when the view first loads, to initialize the array:
Code:
enemies = [[NSMutableArray alloc] init];
If you're doing that ok, then put a breakpoint on the line "for (UIView *anEnemy in enemies){
" , and tell me how many objects are in "enemies" .
__________________
|
|
|
03-27-2009, 05:46 PM
|
#25 (permalink)
|
|
iPhone Developer
Join Date: Mar 2009
Posts: 219
|
Yes..
Quote:
Originally Posted by smasher
Post the code where you create the array "enemies" . There should be a line like this when the view first loads, to initialize the array:
Code:
enemies = [[NSMutableArray alloc] init];
If you're doing that ok, then put a breakpoint on the line "for (UIView *anEnemy in enemies){
" , and tell me how many objects are in "enemies" .
|
Code:
Sorry.... dont have one...
Should i add one now??
__________________
Thank You.
|
|
|
 |
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 403 |
| 30 members and 373 guests |
| alexy, ArgMan, artisan99999, ashim1488, Chilibird, CodeNoob, Gravitation, gregorylepacha, headkaze, hm50, hobbyCoder, joey007, korki696, lepetitapps, maccoykung, maddams, ManWithMask, nbajjuri, odysseus31173, plus size cargo pant, raj_123k, rarindeed, rendezvouscp, sindhutiwari, skycreeper, sle39lvr, smasher, smrtital, ujagtap, warmi |
| Most users ever online was 779, 05-11-2009 at 09:55 AM. |
» Stats |
Members: 23,841
Threads: 38,605
Posts: 169,509
Top Poster: smasher (2,547)
|
| Welcome to our newest member, ashim1488 |
|