Topic:   My iPhone Game Tutorials for Beginners   (Read 270893 times)


0 Members and 1 Guest are viewing this topic.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #315 on: January 13, 2012, 05:03:08 PM »
so yeah yadayda... code defication...

Code: [Select]
#import "Unbeatable_Prefix.pch"


@interface Sprite : NSObject {

UIImage* Image;
UIImageView* Sprite;
CGPoint Location;

}
@property (retain, nonatomic) UIImage* Image;
@property (retain, nonatomic) UIImageView* Sprite;
@property (readwrite, nonatomic) CGPoint Location;

+(void) move:(CGPoint) newPoint; //to be used by the walking and jumping function

-(void) initialize:(stype)spriteType;

@end

Code: [Select]
#import "Sprite.h"


@implementation Sprite
@synthesize Image;
@synthesize Sprite;
@synthesize Location;

+(void) move:(CGPoint) newPoint
{

self.Location = newPoint; /***** error *****/

}

-(void) initialize:(stype)spriteType
{

switch (spriteType) {
case PLAYER:

break;
case MONSTER:

break;
case ENTITY:

break;
case STAGE:

break;

default:
break;
}

}

@end

Accessing unknown setLocation method.
Object cannot be set - either readonly prop. or no setter found
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #316 on: January 13, 2012, 05:06:41 PM »
Code: [Select]
#import "Unbeatable_Prefix.pch"


@interface Sprite : NSObject {

UIImage* Image;
UIImageView* Sprite;
CGPoint Location;

}
@property (retain, nonatomic) UIImage* Image;
@property (retain, nonatomic) UIImageView* Sprite;
@property (assign) CGPoint Location;

-(void) move:(CGPoint) newPoint; //to be used by the walking and jumping function

-(void) initialize:(stype)spriteType;

@end

Code: [Select]
#import "Sprite.h"


@implementation Sprite
@synthesize Image,Sprite,Location;

-(void) move:(CGPoint) newPoint
{

self.Location = newPoint; /***** error *****/

}

-(void) initialize:(stype)spriteType
{

switch (spriteType) {
case PLAYER:

break;
case MONSTER:

break;
case ENTITY:

break;
case STAGE:

break;

default:
break;
}

}

@end

Try that.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #317 on: January 13, 2012, 10:16:35 PM »
I've got two problems. One my method marked problematic code would execute, and there's an uncaught exception: NSInternalInconsistencyException from       UnbeatableViewController.xib. The problem triggers, when the program tries to 'makekeyandvisible'

I've isolated the problems to those areas, but I can't for the life of me even comprehend what I did wrong.

Code: [Select]
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
//initialize the viewController and spriteController
NSLog(@"delegate");
self.viewController = [[UnbeatableViewController alloc] initWithNibName:@"UnbeatableViewController.xib" bundle:[NSBundle mainBundle]];
[[self.viewController sController] init:FIELD]; /***** problematic *****/
NSLog(@"end delegate");

// Set the view controller as the window's root view controller and display.
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    return YES;
}
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #318 on: January 13, 2012, 11:48:49 PM »
Hmm. I see a few lines of code and I'm thinking, "What are you doing there?".

If you could PM me your source I could better debug it.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #319 on: January 15, 2012, 12:08:03 PM »
oh sorry that must've slipped my mind

http://www.mediafire.com/download.php?6fx1ux6567bgx77

The line labeled, problematic code won't even run. And then theres the whole NSInternalInconsistencyException
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #320 on: January 15, 2012, 12:43:22 PM »
I'll try to check this out but I don't think I'm gonna have wifi at all today.

Edit:
I'm doing the 22 hour drive home today.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #321 on: January 16, 2012, 02:01:15 PM »
alright thanks for taking time to look at it. In the future where would I go when I get strange errors like this?

EDIT:
I found out a bit more about 'NSInternalInconsistencyException' in the documentation

NSInternalInconsistencyException
Name of an exception that occurs when an internal assertion fails and implies an unexpected condition within the called code.
Available in Mac OS X v10.0 and later.
Declared in NSException.h.
« Last Edit: January 16, 2012, 02:58:26 PM by GMG Kurt »
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #322 on: January 16, 2012, 03:45:40 PM »

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #323 on: January 16, 2012, 03:52:54 PM »
thank you so much Gan. It works perfectly.  ;D
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #324 on: April 11, 2012, 12:18:02 PM »
gan why is it that when I add a UIView with my UIImageView as a subview to the main view it's all blurry, but when I add a UIImageView as the subview to the main view it's nice and sharp?

NOTE: by main view I mean my ViewController's 'view' property.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #325 on: April 11, 2012, 12:46:14 PM »
The UIImageView is probably being placed in between pixels. Caused by the positions of the UIImageView itself and the UIView it's being placed in.
When place in between pixels, it use Anti-aliasing to make the image be seen as in-between pixels.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #326 on: April 12, 2012, 09:42:08 AM »
Yeah you should try to position images with a whole number is that it?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: My iPhone Game Tutorials for Beginners
« Reply #327 on: April 12, 2012, 10:46:56 AM »
Yeah, if you don't want the slight blurriness.