Cocos2d-x中怎么获取moveTo移动期间的坐标位置
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
2个回答
2015-06-26
展开全部
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {
CCTMXTiledMap *gameWorld = [CCTMXTiledMap tiledMapWithTMXFile:@"PositionText.tmx"];
[self addChild:gameWorld];
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCLOG(@"gameWorld.mapSize.width:%.2f gameWorld.mapSize.height:%.2f",gameWorld.mapSize.width, gameWorld.mapSize.height);
CCLOG(@"gameWorld.tileSize.width: %.2f gameWorld.tileSize.height:%.2f", gameWorld.tileSize.width, gameWorld.tileSize.height);
CCLOG(@"winSize.width:%.2f winSize.height:%.2f", winSize.width, winSize.height);
CCSprite *pointSprite = [CCSprite spriteWithFile:@"point.png"];
[gameWorld addChild:pointSprite z:2 www.hbbz08.comtag:1];
pointSprite.position = ccp(20,20);
pointSprite.anchorPoint = ccp(0.5, 0.5);
CCSprite *rectSprite = [CCSprite spriteWithFile:@"myrect.png"];
[gameWorld addChild:rectSprite z:1 tag:1];
rectSprite.position = ccp(20,20);
rectSprite.anchorPoint = ccp(0.5, 0.5);
}
return self;
}
1、加载地图:
CCTMXTiledMap *gameWorld = [CCTMXTiledMap
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {
CCTMXTiledMap *gameWorld = [CCTMXTiledMap tiledMapWithTMXFile:@"PositionText.tmx"];
[self addChild:gameWorld];
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCLOG(@"gameWorld.mapSize.width:%.2f gameWorld.mapSize.height:%.2f",gameWorld.mapSize.width, gameWorld.mapSize.height);
CCLOG(@"gameWorld.tileSize.width: %.2f gameWorld.tileSize.height:%.2f", gameWorld.tileSize.width, gameWorld.tileSize.height);
CCLOG(@"winSize.width:%.2f winSize.height:%.2f", winSize.width, winSize.height);
CCSprite *pointSprite = [CCSprite spriteWithFile:@"point.png"];
[gameWorld addChild:pointSprite z:2 www.hbbz08.comtag:1];
pointSprite.position = ccp(20,20);
pointSprite.anchorPoint = ccp(0.5, 0.5);
CCSprite *rectSprite = [CCSprite spriteWithFile:@"myrect.png"];
[gameWorld addChild:rectSprite z:1 tag:1];
rectSprite.position = ccp(20,20);
rectSprite.anchorPoint = ccp(0.5, 0.5);
}
return self;
}
1、加载地图:
CCTMXTiledMap *gameWorld = [CCTMXTiledMap
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询