0

So I'm making a IOS game and when I try testing my game in xcode simulator I get these errors below. Anyone have an idea what's wrong. Btw the behaivor is for unlocking new levels if actor collides with an object:

Error in line 49: invalid operands of types 'objc_object*' and 'float' to binary

Error in line 58: invalid operands of types 'objc_object*' and 'float' to binary

Error in line 73 :iso c++ forbids comparison between pointer and integer

Here is the IOS code:
Line 49:

if(([mActor touchedActor] && ([self getGameAttribute:@"Highest Level Completed"] >= [self asNumber:[NSNumber numberWithFloat:_levelnumber]])))

Line 58:
if(([self getGameAttribute:@"Highest Level Completed"] >= [self asNumber:[NSNumber numberWithFloat:_levelnumber]]))

Line 73:
if(([mActor touchedActor] && (([self getGameAttribute:@"Highest Level Completed"] <= 5) && [[Game game] purchasedProduct:@"MyID"])))

All of the code:

#import <Box2D/Box2D.h>
#import <AudioToolbox/AudioServices.h>
#import <Foundation/Foundation.h>
#import "ActorScript.h"

#import "Script.h"

#import "Actor.h"
#import "ActorType.h"
#import "Assets.h"
#import "Behavior.h"
#import "Collision.h"
#import "CollisionPoint.h"
#import "Game.h"
#import "GameModel.h"
#import "GroupDef.h"
#import "FadeInTransition.h"
#import "FadeOutTransition.h"
#import "Region.h"
#import "Runnable.h"
#import "Scene.h"
#import "SHThumbstick.h"
#import "Sparrow.h"
#import "Transition.h"



@interface Design_190_190_Clicktoplaylevel : ActorScript 
{
    @public
        NSString* tempHolder;

Scene* _Scenetoplay;

NSString* _Levellabel;

float _levelnumber;

}
@end

@implementation Design_190_190_Clicktoplaylevel

-(void)load
{
        [self addWhenUpdatedListener:nil func:^(NSMutableArray* list, Script* theScript){
Design_190_190_Clicktoplaylevel* self = (Design_190_190_Clicktoplaylevel*) theScript;

                    if(([mActor touchedActor] && ([self getGameAttribute:[self asNumber:[NSNumber numberWithFloat:[[self getGameAttribute:@"Highest Level Completed"] floatValue]]]] >= [self asNumber:[NSNumber numberWithFloat:_levelnumber]])))
{
                [self setGameAttribute:[[self getGameAttribute:@"Current Level"] floatValue] value:[NSNumber numberWithFloat:[self asNumber:[NSNumber numberWithFloat:_levelnumber]]]];
                [self switchScene:_Scenetoplay.ID leave:[self createFadeOut:((1000*1)) color:0] enter:[self createFadeIn:((1000*1)) color:0]];
}

}];
    [self addWhenDrawingListener:nil func:^(SPRenderSupport* g, int x, int y, BOOL screen, NSMutableArray* list, Script* theScript){
Design_190_190_Clicktoplaylevel* self = (Design_190_190_Clicktoplaylevel*) theScript;
        if(([self getGameAttribute:[self asNumber:[NSNumber numberWithFloat:[[self getGameAttribute:@"Highest Level Completed"] floatValue]]]] >= [self asNumber:[NSNumber numberWithFloat:_levelnumber]]))
{
            [mActor setAnimation:@"Animation 1"];
            [[Game game] setFont:[ self getFont:52] size:1];
            [[Game game] drawString:_Levellabel x:(([mActor getWidth] - [[Game game] getWidthForString:[ self getFont:52] string:_Levellabel]) / 2) y:30];
}

        else
{
            [mActor setAnimation:@"Animation 0"];
}

}];
    [self addWhenUpdatedListener:nil func:^(NSMutableArray* list, Script* theScript){
Design_190_190_Clicktoplaylevel* self = (Design_190_190_Clicktoplaylevel*) theScript;
                    if(([mActor touchedActor] && (([self getGameAttribute:[self asNumber:[NSNumber numberWithFloat:[[self getGameAttribute:@"Highest Level Completed"] floatValue]]]] <= [self asNumber:[NSNumber numberWithFloat:5]]) && [[Game game] purchasedProduct:@"MyID"])))
{
                [self setGameAttribute:[[self getGameAttribute:@"Current Level"] floatValue] value:[NSNumber numberWithFloat:[self asNumber:[NSNumber numberWithFloat:_levelnumber]]]];
                [self switchScene:_Scenetoplay.ID leave:[self createFadeOut:((1000*1)) color:0] enter:[self createFadeIn:((1000*1)) color:0]];
}

            else if((([mActor touchedActor] && [self sameAs:[self getGameAttribute:[self asNumber:[NSNumber numberWithFloat:[[self getGameAttribute:@"Highest Level Completed"] floatValue]]]] two:[NSNumber numberWithFloat:[self asNumber:[NSNumber numberWithFloat:5]]]]) && !([[Game game] purchasedProduct:@"MyID"])))
{
                return;
}


}];

} 




-(void)forwardMessage:(NSString*)msg
{
2
Contributors
1
Reply
17
Views
4 Years
Discussion Span
Last Post by Labdabeta
1

Im fairly certain that the language you are using is objective-c. You will most likely get more luck if you move this over to the objective-c section.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.