AlertView Actions....

Discussion in 'iOS Programming' started by TrentS, Jul 7, 2014.

  1. TrentS, Jul 7, 2014
    Last edited by a moderator: Jul 7, 2014

    TrentS macrumors 6502

    TrentS

    Joined:
    Sep 24, 2011
    Location:
    Overland Park, Kansas
    #1
    I am working with AlertViews in my game app and want to make it so that when you click the buttons below the initial alert, they will move you to the next level, or take you back to the same level again. Right now I just have "Play again" which starts the game over, but want to change it up some. Any ideas how I can do this? I'm sure it is simple, but if anyone can help me out, it point me in the direction of some tutorials on this, that would be great. Thanks!


    Sample of my code......

    Code:
    if (CGRectIntersectsRect(Object1.frame, Object2.frame)) {
    
            ScoreNumber = ScoreNumber + 200;
    
            Score.text = [NSString stringWithFormat:@"Score: %i", ScoreNumber];
    
            Object1.image = [UIImage imageNamed:@"Object3"];
    
            
    
            [backgroundMusic stop];
    
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congrat! Level 1 completed!"
    
                                                  message:[NSString stringWithFormat:@"You scored %i points", ScoreNumber]
    
                                                  delegate:self
    
                                                  cancelButtonTitle:@"Move to Level 2."
    
                                                  otherButtonTitles:@"Play Level 1 again!", nil];
    
            [alert show];
    
            
    }

    :) :) :) :)
     
  2. JohnsonK macrumors regular

    Joined:
    Mar 6, 2014
    #2
    In order to move to the next level you have to among other things, initialise the next level's objects, for instance. But again, we know nothing about the structure of your game, there is no way we can help you. All you are currently doing is copying and pasting code from somewhere.

    I recommend you to step back and read an algorithm book then an introduction to programming, so then you won't get frustrated and instead actually enjoy programming
     

Share This Page