2010-04-13 116 views
0

我在创建一个游戏,因为我想使用一些动画,但我是新来的动画。 我想创建一个图像,只要我点击imageview,图像应该以弹跳的方式进来,就像它是一个球,所以有可能这样做吗?该图像是为游戏预定义的,并且它必须在触摸开始事件发生之后发生,任何人都可以帮助我吗? 关于 病毒。动画图像

+0

答案对此相当涉及。你需要阅读电脑动画或游戏编程。 – 2010-04-13 11:57:51

+1

如果你能想象它,那么它几乎可以肯定是编码,你试过什么代码? – amelvin 2010-04-13 11:59:03

+0

我还没有添加任何动画代码,现在我尽快显示简单的值,只要我触摸图像视图,但我想要一些不同的图像动画。 – 2010-04-13 12:07:00

回答

0

,你可以这样做

imageview = [[[UIImageView alloc] initWithFrame:CGRectMake(x,y,w,h)]autorelease]; 
    imageview.image = [[UIImage imageNamed: [NSString stringWithString:name]]autorelease]; 
    [self.view addSubview:imageview]; 
    imageview.frame = CGRectMake(imageview.frame.origin.x, (imageview.frame.origin.y), imageview.frame.size.width, imageview.frame.size.height); 
    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDelegate:self]; 
    //[UIView setAnimationWillStartSelector:@selector(Transform2)]; 


    [UIView setAnimationDuration:k_AnimateTime]; 

    [UIView setAnimationBeginsFromCurrentState:YES]; 
    //[UIView setAnimationDidStopSelector:@selector(increaseCount)]; 
    imageview.frame = CGRectMake(imageview.frame.origin.x - Ex, (imageview.frame.origin.y - Ey), imageview.frame.size.width, imageview.frame.size.height); 
    [UIView commitAnimations]; 

这将您的图像从一个共同的坐标移动到另一个坐标动画...设置适当的坐标,使其看起来像弹跳effcet ...

+0

感谢哥们,现在让我试试这个并回复相同的问题。和谢谢.... – 2010-04-13 13:33:03