Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Hello, I am trying to figure out how to make an array start when another one stops on a certain image. So for example say I have three images in the first array, if the user stops the array and it lands on image 2, i want this to trigger another array. However, if a user stops the first array on image 1, the first array continues to play while the second one does not. Is there anyway I can do this? Thank you.
The button attached to startClick starts the array. I also have a button that stops the array. My question is, how would I make the array go faster after the user stops the array on a certain image?
Does anybody understand what I'm even asking for? This is what I have so far but I keep getting an error saying "expected identifier or "{" before 'if'
Now that your code is more readable let's look at it.
-You should be referring to your image by index number not by image name
Firstly, thanks for the tip on posting the code, I've been trying to figure that out. Secondly, I'm a novice at programming so i'm not exactly sure if an index number is automatically generated or not. What would i need to do if all i wanted was to speed up the array every time the user clicks stop when the array is on the "yellow goal"? Thanks for your patience by the way
Also, don't reinstantiate the array every time a button is pushed...it looks like a static array so NSArray is correct, but declare it in your header file and define it in your implementation file so it is available to all your methods
In my game I have an animation via an array, and every time the user clicks a button, if the array is on a certain image, i want the array to start over and speed up. Here is what I have so far. I keep getting an error saying "expected expression before 'UIImage'" Sorry I needed to clarify myself. What's wrong with this code?
I keep toying around and cannot do anything about this error message. I'm guessing its something small but I can't figure out what. This is the updated code:
dljefferyPosts: 1,311iPhone Dev SDK Supporter, Registered Users
aa233;294260 said:
I keep toying around and cannot do anything about this error message. I'm guessing its something small but I can't figure out what. This is the updated code:
Replies
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomestick.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"red enemy.png"],
[UIImage imageNamed:@"yellow goal.png"],
[UIImage imageNamed:@"blue user.png"],nil];
[stick setAnimationRepeatCount:0];
stick.animationDuration = 1;
[stick startAnimating];
}
The button attached to startClick starts the array. I also have a button that stops the array. My question is, how would I make the array go faster after the user stops the array on a certain image?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome-(IBAction)startClick:(id)sender {
stick.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"red enemy.png"],
[UIImage imageNamed:@"yellow goal.png"],
[UIImage imageNamed:@"blue user.png"],nil];
[stick setAnimationRepeatCount:0];
stick.animationDuration = 1;
[stick startAnimating];
}
-(IBAction)stopClick:(id)sender {
stick.animationImages = nil;
}
if ((stopClick == TRUE) && (stick.animationImages = UIImage imageNamed:@"yellow goal.png")) {
stick.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"red enemy.png"],
[UIImage imageNamed:@"yellow goal.png"],
[UIImage imageNamed:@"blue user.png"],nil];
[stick setAnimationRepeatCount:0];
stick.animationDuration = .5;
[stick startAnimating];
}
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThe Predictor: College Basketball
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeNow that your code is more readable let's look at it.
-You should be referring to your image by index number not by image name
The Predictor: College Basketball
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThanks for your patience by the way
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeYou should probably use the objectAtIndex...Index numbers in an array start at 0.
The Predictor: College Basketball
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThe Predictor: College Basketball
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome#-(IBAction)startClickid)sender {
stick.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"red enemy.png"],
[UIImage imageNamed:@"yellow goal.png"],
[UIImage imageNamed:@"blue user.png"],nil];
[stick setAnimationRepeatCount:0];
stick.animationDuration = 1;
[stick startAnimating];
}
- (IBAction)Fasterid)sender {
if (UIImage = @"yellow goal.png") {
stick.animationDuration = .5;
}
}#
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- (IBAction)Faster:(id)sender {
if (UIImage = [@"yellow goal.png"] {
stick.animationDuration = .5;
else {
stick.animationDuration = 1;
}
}
}
The error messages now say expected expression before 'UIImage' and expected expression before '}' token (in reference to the third bracket)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeObjective-C Introduction
Recall It! for iPad
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomeor manually
[ C O D E ]
[ / C O D E ]
remove the spaces
define the array in viewDidLoad or viewWillLoad
The Predictor: College Basketball
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome