正在制作一个用于射击物体的正典.柱塞的背面是柱塞的附件.柱塞用于设定速度和角度.佳能旋转0-90度,柱塞前后移动,调节速度.当我通过触摸旋转佳能时,其工作正常.当柱塞通过移动而被拉回并且其旋转意味着柱塞被束缚在佳能之外.
如何控制这个: -
移动时我的柱塞和佳能旋转代码.(para3是佳能,para6是我的柱塞): -
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
CGPoint oldTouchLocation = [touch previousLocationInView:touch.view];
oldTouchLocation = [[CCDirector sharedDirector] convertToGL:oldTouchLocation];
oldTouchLocation = [self convertToNodeSpace:oldTouchLocation];
if (CGRectContainsPoint(CGRectMake(para6.position.x-para6.contentSize.width/2, para6.position.y-para6.contentSize.height/2, para6.contentSize.width, para6.contentSize.height), touchLocation) && (touchLocation.y-oldTouchLocation.y == 0))
{
CGPoint diff = ccpSub(touchLocation, oldTouchLocation);
CGPoint currentpos = [para6 position];
NSLog(@"%d",currentpos);
CGPoint destination = ccpAdd(currentpos, diff);
if (destination.x < 90 && destination.x >70)
{
[para6 setPosition:destination];
speed = (70 + (90-destination.x))*3.5 ;
}
}
if(CGRectIntersectsRect((CGRectMake(para6.position.x-para6.contentSize.width/8, (para6.position.y+30)-para6.contentSize.height/10, para6.contentSize.width, para6.contentSize.height/10)),(CGRectMake(para3.position.x-para3.contentSize.width/2, para3.position.y-para3.contentSize.height/2, para3.contentSize.width, para3.contentSize.height))))
{
[para3 runAction:[CCSequence …Run Code Online (Sandbox Code Playgroud) 如何在特定位置移动对象.
举些例子.我有一个小条(宽= 50,高= 10).我必须手动移动这个柱塞.我想只在x cordinates中移动(限制是x = 20(起始点)到x = 50(终点))y坐标上没有移动.但是在病房没有动静的情况下它移动了50到10.
编码:-
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (isPlaying) {
UITouch *touch = [[event allTouches] anyObject];
touchPosition = [touch locationInView:touch.view];
if ( CGRectContainsPoint(para3.boundingBox,touchPoint)
isDragging = YES;
touchOffset = para3.position.y - touchPosition.y;
}
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if (isPlaying) {
UITouch *touch3 = [[event allTouches] anyObject];
float distanceMoved =
([touch3 locationInView:touch3.view].y + touchOffset) -
para3.position.y;
float newY = para3.position.y + distanceMoved;
if (newY > 67 && newY < 99)
para3.position …Run Code Online (Sandbox Code Playgroud) 我正在玩10级游戏.我希望在第一级完成时将第二级锁定图像更改为解锁.
我正在使用20张图像(10张锁定,10张未锁定).
我正在使用cc菜单来显示数字图像.例如(代码): -
CCMenuItemImage *startButton12 = [CCMenuItemImage itemFromNormalImage:@"ten_new-lock.png"
selectedImage:@"ten_new-lock.png" target:self
selector:@selector(ten:)];
menu1 = [CCMenu menuWithItems: startButton3,startButton4,startButton5,startButton6,startButton7,startButton8,startButton9,startButton10,startButton11,startButton12, nil];
menu1.position = ccp(240,30);
[menu1 alignItemsHorizontally];
[menuLayer1 addChild: menu1];
Run Code Online (Sandbox Code Playgroud)
我使用下面的代码记住完成的级别.
int lastLevelCompleted= [[NSUserDefaults standardUserDefaults] integerForKey:@"levelCompleted"];
if(currentLevel >lastLevelCompleted){
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger:currentLevel forKey:@"levelCompleted"];
Run Code Online (Sandbox Code Playgroud)
**现在,如何更改锁定以解锁图像.
(如果我在这里做错了)还有其他解决方法提供的方法.我必须实现那一个.**
无需在iphone设备中启动前置摄像头即可拍摄照片
如果是的话,请提供该示例教程以供参考.
我想用前置摄像头拍照.但用户不会看到相机屏幕.在后端它必须拍照并保存在相册中
我正在使用sharekit在Facebook,Twitter和电子邮件中共享图像
在Facebook正确工作.Twitter和电子邮件正在uiview的后面工作.(见下面的截图).
在这里,您可以看到Twitter表单是UIview的背面.对于电子邮件也发生了同样的事情.看到电子邮件comtroller是UIview的背面.
在这里,我在uiviewcontroller中使用 uiview进行图像幻灯片显示.
我正在使用此代码连接twitter
SHKItem *twitterItem = [SHKItem image:mCurrentImageView.image title:@"Check out my photos! "];
[SHKTwitter shareItem:twitterItem];
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码连接邮件
SHKItem *mail = [SHKItem image:mCurrentImageView.image title:@"Check out my photos! "];
[SHKMail shareItem:mail];
Run Code Online (Sandbox Code Playgroud)
我错了..在这不知道帮助...
提前致谢..
这是最好的iPhone 3D游戏引擎,
我已经知道cocos2d,在cocos3d中,我不知道如何制作基本样本,
同时我正在研究任何其他3D游戏引擎比cocos3d更好.
如果你们建议任何引擎,给予链接或样本以便更快地学习......
游戏引擎像cocos2d一样支持目标c
嗨,任何人都可以建议我有可能,如果可能的话,怎么样?
前提是用户通过网站支付应用程序费用,并获得访问代码以通过网站发送给她的客人.用户从iPhone商店下载免费应用程序并输入代码.我们试图弄清楚我们是否可以让每个用户自定义应用图标,以便在用户手机上显示不同的图像或文字.
iphone ×7
objective-c ×6
ios ×3
ios4 ×2
3d ×1
cocoa-touch ×1
game-engine ×1
sdk ×1
sharekit ×1
sprite ×1
xcode ×1