Hi, I have been stuck on this for a few days now trying different things but to no avail.
I want to generate a number with arc4random and then make that number save in my PowerRandom int. Then make JUST the name PowerRandom one of my objects name in my game, and then use that name that the number is set on to call an object. Its hard to explain I will just input the code.
Code:
if(Cyclelabel == 0) {
PowerRandom = arc4random() % 5;
lblPowerRandom.text = [NSString stringWithFormat:@"%d", PowerRandom];
}
if(PowerRandom == 1) {
PowerRandom == pad1;
}
if(PowerRandom == 2) {
PowerRandom == pad2;
}
if(PowerRandom == 3) {
PowerRandom == pad3;
}
AND SO On...
So in the above when my timer hits 0, a random number is generated and the PowerRandom int becomes that number that gets transfered to the label.
Then I check if PowerRandom is 2 for example, and if it is, that name PowerRandom becomes a substitute for THE NAME pad2 which is a Object.
The above gives me an error "Comparison Between points and integer" Yellow.
THEN what i want to do this:
Code:
piece.center = CGPointMake(PowerRandom.center.x,PowerRandom.center.y - 25);
So whatever PowerRandom becomes, it is used to be either pad 1 2 3 4 and so on.. and then all i need is that one line of code to place my piece which is a power up. Im sorry if this is a bit complicated, i tried to explain as best as i can. Anyone Know how to do this?