Getting this error in Xcode 4. I am reading a book which uses 0.99.5 I think and I am using the 1.0.0 framework for cocos2d.
error: Semantic Issue: Assigning to ‘CGPoint’ (aka ‘struct CGPoint’) from incompatible type ‘double’
on this line
playerVelocity = playerVelocity.x * dec + acceleration.x * sens;
Any ideas.
Full code
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;
}
playerVelocityis a vector, so you should assign a value to it like this:ccpmacro will build a vector for you with the two component you specify. I gave 0 as y component, feel free to change this value as you need.