开发者

How can I change the position of an object through the ccp function in cocos2d?

I am new to the cocos2d framework, so I took the sample application from this location and tried to modify it. By using the line

target.position = ccp(winSize.width , (target.contentSize.width/2)+actualY);

the object is shown in landscape. When the app runs it will show me the output in landscape mode, and the targets are shown from the starting the landscape mode of one side to another side. I want to show it from the the end 开发者_JAVA百科of the landscape mode to the start. How can I do this?

Also, I want to show in portrait mode. How can I do this as well?


ok use ccp function. the body will be like this. ccp(x, y)


OK, cpp function means the same as CGPointMake(x,y) - only creates a point for position of target.

winSize.width - will be xcoordinate of target, and (target.contentSize.width/2)+actualY - ycoordinate


What version of cocos2d u using? You can change orientation of app in the app delegate.. From landscape to portrait..


ok I solve that problem, I simply change the position of x and y through ccp function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜