2011-07-22 10 views
0

Xcodeでこのエラーが発生する4.私は0.99.5を使用している本を読んでいると思いますが、私はcocos2dの1.0.0フレームワークを使用しています。cocos2d意味論的な問題

エラー:セマンティック問題:互換性のない型から 'するCGPoint'(別名 '構造体するCGPoint')に割り当てる 'ダブル'

このライン上の

playerVelocity = playerVelocity.x * dec + acceleration.x * sens; 

任意のアイデア。あなたはこのようにそれに値を割り当てる必要がありますので

全コード

float dec = 0.4f; //lower = quicker to change direction; 
float sens = 6.0f; //higher more sensitive; 
float maxVel = 100; 

playerVelocity = playerVelocity.x * dec + acceleration.x * sens; 

if(playerVelocity.x > maxVel) 
{ 

} 
else if(playerVelocity.x < - maxVel) 
{ 
    playerVelocity.x = - maxVel; 
} 

答えて

0

playerVelocityは、ベクトルである:

playerVelocity = ccp(playerVelocity.x * dec + acceleration.x * sens, 0); 

ccpマクロは、ユーザーが指定する2つのコンポーネントで、あなたのためのベクターを構築します。私はy成分として0を与え、必要に応じてこの値を自由に変更してください。

0

だからplayerVelocityがポイントですが、 "playerVelocity.x * 12月+ acceleration.x * SENS" のダブルです。

ポイントにダブルを割り当てることはできません。私はあなたが意味を考える

、 playerVelocity.x = playerVelocity.x * 12月+ acceleration.x * SENS。 ?