まだゲームに取り組んでおり、難易度ごとに「gameSpeed」があります。これは、選択した難易度に応じて設定されます。
ただし、アプリケーションを実行しようとすると、次のエラーが発生します。
duplicate symbol _gameSpeed in:
/Users/Ashley/Library/Developer/Xcode/DerivedData/Whack-etfeadnxmmtdkgdoyvgumsuaapsz/Build/Intermediates/Whack.build/Debug-iphonesimulator/Whack.build/Objects-normal/i386/TimedGameLayer.o
/Users/Ashley/Library/Developer/Xcode/DerivedData/Whack-etfeadnxmmtdkgdoyvgumsuaapsz/Build/Intermediates/Whack.build/Debug-iphonesimulator/Whack.build/Objects-normal/i386/GameInfo.o
ld: 1 duplicate symbols for architecture i386
collect2: ld returned 1 exit status
Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
私は1つの場所でgameSpeedのみを使用しています。
これはここにあります:
[self schedule:@selector(tryPopMoles:) interval:gameSpeed];
これは私のTimedGameLayer.mの中にあります
gameSpeed変数は私のGameInfo.hにあります
私は次のようにヘッダーをインポートします:
#import "GameInfo.h"
私のGameInfo.hは次のようになります。
@interface GameInfo : NSObject
+(void)setupGame:(enum GameType)type withArg2:(enum GameDifficulty)difficulty;
+(void)resetGame;
+(void)togglePause;
@end
//Game Type
enum GameType gameType;
enum GameDifficulty gameDifficulty;
//Release Version
NSString *version;
//Settings
int gameSpeed = 1.5;
//Stats
int touches = 0;
int score = 0;
int totalSpawns = 0;
//usables
bool gamePaused = FALSE;
typedef enum GameType {
GameTypeClassic = 0,
GameTypeUnlimited,
GameTypeTimed,
GameTypeExpert,
} GameType;
typedef enum GameDifficulty
{
GameDifficultyEasy = 0,
GameDifficultyMedium,
GameDifficultyHard,
} GameDifficulty;
setupGame関数(GameInfo.mファイルにあります)は次のようになります。
+(void)setupGame:(enum GameType)type withArg2:(enum GameDifficulty)difficulty
{
gameType = type;
gameDifficulty = difficulty;
switch(gameDifficulty)
{
case GameDifficultyEasy:
gameSpeed = 1.5;
break;
case GameDifficultyMedium:
gameSpeed = 1.0;
break;
case GameDifficultyHard:
gameSpeed = 0.5;
break;
}
}
私はここで完全に失われました...
何か案は?
ありがとう