Xcode シミュレーターでゲームをテストしようとすると、以下のエラーが発生します。誰でも何が悪いのか考えています。ところで、振る舞いは、アクタがオブジェクトと衝突した場合に新しいレベルのロックを解除するためのものです:
49 行目のエラー: タイプ 'objc_object*' および 'float' のオペランドが無効です
行 58 のエラー: タイプ 'objc_object*' および 'float' からバイナリへの無効なオペランド
73行目のエラー:iso c++はポインタと整数の比較を禁止しています
これが IOS コードです: 行 49:
if(([mActor touchedActor] && ([self getGameAttribute:@"Highest Level Completed"] >= [self asNumber:[NSNumber numberWithFloat:_levelnumber]])))
58 行目:
if(([self getGameAttribute:@"Highest Level Completed"] >= [self asNumber:[NSNumber numberWithFloat:_levelnumber]]))
73 行目:
if(([mActor touchedActor] && (([self getGameAttribute:@"Highest Level Completed"] <= 5) && [[Game game] purchasedProduct:@"MyID"])))
動作のすべてのコード:
#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
{