Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:52:43+00:00 2026-06-09T19:52:43+00:00

So I was just coding along, then Xcode just started going whack when I

  • 0

So I was just coding along, then Xcode just started going whack when I hit build and gave me all these error that I have never had before

Here is the file:

import

#import <OpenGLES/EAGLDrawable.h>

#import "EAGLView.h"

#define USE_DEPTH_BUFFER 0

// A class extension to declare private methods @interface EAGLView ()

@property (nonatomic, retain) EAGLContext *context; @property (nonatomic, assign) NSTimer *animationTimer;

- (BOOL) createFramebuffer;
- (void) destroyFramebuffer;
- (void) updateScene:(float)delta;
- (void) renderScene;

@end


@implementation EAGLView

@synthesize context; @synthesize animationTimer; @synthesize animationInterval;


// You must implement this method
+ (Class)layerClass {
    return [CAEAGLLayer class]; }


//The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:
- (id)initWithCoder:(NSCoder*)coder {

    if ((self = [super initWithCoder:coder])) {
        // Get the layer
        CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;

        eaglLayer.opaque = YES;
        eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                        [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking,

kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];

        context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];

        if (!context || ![EAGLContext setCurrentContext:context]) {
            [self release];
            return nil;
        }

        animationInterval = 1.0 / 60.0;
              CGRect rect = [[UIScreen mainScreen] bounds];
              // Set up OpenGL projection matrix      glMatrixMode(GL_PROJECTION);        glLoadIdentity();       glOrthof(0,

rect.size.width, 0, rect.size.height, -1, 1);
glMatrixMode(GL_MODELVIEW); glViewport(0, 0, rect.size.width,
rect.size.height);
// Initialize OpenGL states glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_DEPTH_TEST);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND_SRC);
glEnableClientState(GL_VERTEX_ARRAY); glClearColor(0.0f, 0.0f,
0.0f, 1.0f);
// init [self initGame];

        UIAccelerometer *accel = [UIAccelerometer sharedAccelerometer];
        accel.delegate = self;
        accel.updateInterval = 1.0f / 60.0f;

        //[sharedSoundManager playMusicWithKey:@"song" timesToRepeat:-1];
    }
    return self; }

-(void) initGame{
    //SET GAME STATE
    //0 = Menu
    //1 = Gameplay
    //2 = death screen
    gameState = 0;

    player = [[Circle alloc] init];

    score = 0;
    scoreString = [NSString alloc];
    scoreAdder = 1;
    //[self setupScore];

    menu = [[Image alloc] initWithImage:[UIImage imageNamed:@"loadImage.png"]];
    bk = [[Image alloc] initWithImage:[UIImage imageNamed:@"bk.png"]];
    squared = [[Image alloc] initWithImage:[UIImage imageNamed:@"squared.png"]];

    gameRunning = TRUE;
    gameState = 0;

    squares = [[Squares alloc] init];
    [squares addSquare: CGPointMake(100, 100) : 0];
    //font = [[AngelCodeFont alloc]initWithFontImageNamed:@"font1.png" controlFile:@"font1.fnt"

scale: 0.0f filter: nil];

    // Init sound     sharedSoundManager = [SingletonSoundManager sharedSoundManager];    [sharedSoundManager loadSoundWithKey:@"menu"

fileName:@”Menu” fileExt:@”mp3″ frequency: 22050];
[sharedSoundManager loadBackgroundMusicWithKey:@”music” fileName:@”bkmusic” fileExt:@”aif”];

    menuMusicVariable = 1;
    gameMusicVariable = 1;
     }

-(void) setRunning: (bool) boolean{
    gameRunning = boolean; }

-(void) runContinueCountdown{
    if(gameRunning == NO){

        int timer = 300;
        int countdownNum;
        timer --;


        if(timer <= 300){
            if(timer > 200){
                countdownNum = 3;
            }

        if(timer <= 200){
            if(timer > 100){
                countdownNum = 2;
            }
        }

        if(timer <= 100){
            if(timer >= 1){
                countdownNum = 1;
            }
        }

        if(timer == 0 && countdownNum == 1){
            [self setRunning: YES];
        }
    } }


- (void) mainGameLoop {   CFTimeInterval      time;   float               delta;  time = CFAbsoluteTimeGetCurrent();  delta = (time - lastTime);  

[self updateScene:delta]; [self renderScene]; lastTime = time;
}

- (void)updateScene:(float)delta {    // Update Game Logic
    if(gameRunning){
        if(gameState == 0){

            //MENU

            if(menuMusicVariable == 1){
                [sharedSoundManager stopPlayingMusic];
                [sharedSoundManager playSoundWithKey:@"Menu" gain:10 pitch:10 location:Vector2fMake(0, 0) shouldLoop: TRUE];
                menuMusicVariable = 0;
            }

            [scoreLabel setHidden: YES];

        } else if(gameState == 1){

            //GAMEPLAY

            if(gameMusicVariable == 1){
                [sharedSoundManager stopPlayingMusic];
                [sharedSoundManager playMusicWithKey: @"music" timesToRepeat: -1];
                gameMusicVariable = 0;
            }

            [scoreLabel setHidden: NO];

            //game is running

            if([player getAlive] == true){
                score = score + scoreAdder;
            } else {
                score = score;
            }

            [player move];

            [self checkSquareToCircleCollisions];
            [self checkSquareToSquareCollisions];

            [squares update];

        } else if(gameState == 2){

            //DEATH SCREEN

            [sharedSoundManager stopPlayingMusic];

            [scoreLabel setBounds: CGRectMake(100, 100 , 100, 40)];
        }
    } else {
        //game is puased

    } }


- (void)renderScene {
      // Make sure we are renderin to the frame buffer
    [EAGLContext setCurrentContext:context];
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
      // Clear the color buffer with the glClearColor which has been set  glClear(GL_COLOR_BUFFER_BIT);       //Render the game Scene 
    if(gameState == 0){

        //MENU
        [menu renderAtPoint: CGPointMake(0, 0) centerOfImage: NO];

    } else if(gameState == 1){

        //GAMEPLAY

        [bk renderAtPoint: CGPointMake(0, 0) centerOfImage: NO];

        [self drawScore];

        [player draw];

        [squares render];
        //[font drawStringAt: CGPointMake(150, 100) text:@"HELLO FONTS"];
    } else if(gameState ==2){

        //DEATH SCREEN

        [squared renderAtPoint: CGPointMake(0, 0) centerOfImage: NO];

    }         // Switch the render buffer and framebuffer so our scene is displayed on the screen
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER_OES]; }


- (void)layoutSubviews {
    [EAGLContext setCurrentContext:context];
    [self destroyFramebuffer];
    [self createFramebuffer];
    [self renderScene]; }


- (BOOL)createFramebuffer {

    glGenFramebuffersOES(1, &viewFramebuffer);
    glGenRenderbuffersOES(1, &viewRenderbuffer);

    glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
    [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
    glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);

    glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
    glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);

    if (USE_DEPTH_BUFFER) {
        glGenRenderbuffersOES(1, &depthRenderbuffer);
        glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
        glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
        glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);
    }

    if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
        NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
        return NO;
    }

    return YES; }


- (void)destroyFramebuffer {

    glDeleteFramebuffersOES(1, &viewFramebuffer);
    viewFramebuffer = 0;
    glDeleteRenderbuffersOES(1, &viewRenderbuffer);
    viewRenderbuffer = 0;

    if(depthRenderbuffer) {
        glDeleteRenderbuffersOES(1, &depthRenderbuffer);
        depthRenderbuffer = 0;
    } }


- (void)startAnimation {
    self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self

selector:@selector(mainGameLoop) userInfo:nil repeats:YES]; }

- (void)stopAnimation {
    self.animationTimer = nil; }


- (void)setAnimationTimer:(NSTimer *)newTimer {
    [animationTimer invalidate];
    animationTimer = newTimer; }


- (void)setAnimationInterval:(NSTimeInterval)interval {

    animationInterval = interval;
    if (animationTimer) {
        [self stopAnimation];
        [self startAnimation];
    } }



-(void) setupScore{

    scoreLabel = [NSString stringWithFormat:@"%d", score];
    scoreLabel.frame = CGRectMake(262, 250, 100, 40);
    [scoreLabel setText: scoreString];

    //normally you'll want a transparent background for your label
    scoreLabel.backgroundColor = [UIColor clearColor]; 

    //you can use non-standard fonts
    [scoreLabel setFont:[UIFont fontWithName:@"TimesNewRoman" size: 1.0f]];

    //change the label's text color
    scoreLabel.textColor = [UIColor whiteColor];

    //add it to your view
    scoreLabel.transform = CGAffineTransformMakeRotation(89.53);
    [self addSubview:scoreLabel]; }

-(void) resetScore {
    score = 0;
    scoreLabel.textColor = [UIColor blackColor];
    [scoreLabel release]; }

-(void)drawScore{  
    [scoreLabel setText: scoreString]; }

-(void) checkSquareToCircleCollisions{
    NSMutableArray *array = [squares getSquares];

    for(int i = 0; i < [squares getCount]; i++){

        Square *s = [array objectAtIndex: i];

        CGRect rect1 = [player getRect];
        CGRect rect2 = [s getRect];

        if (CGRectIntersectsRect(rect1, rect2)){

            player.alive = NO;
            gameState = 2;

        }

    } }

-(void) checkSquareToSquareCollisions{
    NSMutableArray *array = [squares getSquares];

    for(int i = 0; i < [squares getCount]; i++){

        Square *s = [array objectAtIndex: 0];
        Square *ss = [array objectAtIndex: i];

        CGRect rect1 = [s getRect];
        CGRect rect2 = [ss getRect];

        if (CGRectIntersectsRect(rect1, rect2)) {
            [s setDirection: [s getXDir] * -1 : [s getYDir] * -1];
            [ss setDirection: [ss getXDir] * -1 : [ss getYDir] * -1];
        }

    } }

-(void) spawnSquares {
    // FINISH METHOD
     }

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    if(gameState == 0){

        //MENU

        UITouch *touch = [[event allTouches] anyObject];

        gameState = 1;
        //[self initGame];

    } else if(gameState == 1){

        //GAMEPLAY

        UITouch *touch = [[event allTouches] anyObject];
        CGPoint touchPos = [touch locationInView:touch.view];
        touchPos.y = 480 - touchPos.y;
        [player setPos: touchPos];

    } else if(gameState == 2){

        //DEATH SCREEN

        UITouch *touch = [[event allTouches] anyObject];

        gameState = 0;
        //[self resetScore];
        [self initGame];
    } }

-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

    if(gameState == 0){

        //MENU

        UITouch *touch = [[event allTouches] anyObject];

        //[self initGame];

    } else if(gameState == 1){

        //GAMEPLAY

        UITouch *touch = [[event allTouches] anyObject];
        CGPoint touchPos = [touch locationInView:touch.view];
        touchPos.y = 480 - touchPos.y;
        [player setPos: touchPos];

    } else if(gameState == 2){

        //DEATH SCREEN

        UITouch *touch = [[event allTouches] anyObject];

    }}

- (void)accelerometer:(UIAccelerometer *)accelerometer
        didAccelerate:(UIAcceleration *)acceleration {

    point.y = acceleration.y * 10;
    point.x = acceleration.x * 10;

    CGPoint pos = [player getPos];

    pos = CGPointMake(pos.x + point.x, pos.y + point.y);
    [player setPos: pos];

    //Right - MAY HAVE TO CHANGE
    if(pos.x < 0){
        pos = CGPointMake(320, pos.y);
    }

    //left
    if(pos.x < 320){
        pos = CGPointMake(0, pos.y);
    }

    //Top
    if(pos.y < 0){
        pos = CGPointMake(pos.x, 460);
    }

    //Bottom
    if(pos.x < 460){
        pos = CGPointMake(pos.x, 0);
    }
     }

- (void)dealloc {

    [self stopAnimation];

    if ([EAGLContext currentContext] == context) {
        [EAGLContext setCurrentContext:nil];
    }

    [context release];  
    [player release];
    [menu release];
    [sharedSoundManager release];
    [bk release];
    [squared release];
    [squares release];
    [scoreLabel release];
    [scoreString release];

    [super dealloc]; }

@end // here it says: excepted } and also its excepting @end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:52:44+00:00Added an answer on June 9, 2026 at 7:52 pm

    You are missing a brace in the runContinueCountdown at the end of the second if statement.

    if(timer <= 300){
                if(timer > 200){
                    countdownNum = 3;
                }
    

    Add a brace to the end of this if statement

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I was just coding a bit today, and I realized that I don't
Just started coding in AS3 with FlashDevelop and coming from a C# background, I
I have just started coding in AS3 and it would be really great to
I had been happily coding along on a decent sized solution (just over 13k
I was just coding a Stripes action bean, starting with an annotated method. By
Just to give a little background: I'm using Dreamweaver CS5 for coding php, XAMPP
I am new to coding and would just like to know a bit more
Just getting my head around WCF, so forgive me for the inelegant coding. The
I'm relatively new to coding; most of my work has been just simple GUI
I almost done my coding for a specific program i have. I just need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.