English 中文(简体)
Coco2d-iPhone人 Layer鱼
原标题:Problem animating a Parallax Layer in Cocos2d-iPhone

页: 1

因此,我自己的Pallaxospheres overwrites setPosition 类似方法

- (void) setPosition:(CGPoint)point
{
    [super setPosition:CGPointMake(point.x / pRatio, point.y / pRatio)];
}

<代码>pRatio 是int,通过创造Pallax effect I m 看望而减少电层移动量。 它与这一点完全一样。

然而,有时我需要利用MoveTo与某个特定职位接洽,因此我制定了这一方法,以回应国家核通知制度。

- (void) gotoStartPosition:(NSNotification *)notification
{
    CGPoint startPos = CGPointFromString([notification object]);
    id moveToStart = [MoveTo actionWithDuration:1 position:startPos];
    [self runAction:moveToStart];

}

在我确定PRatio之前,哪些工作要做。 如果pRatio高于1,那么gotoStartPosition使该层跳跃到,并从中抽取。

我可以指出,在什么时候,电离层的位置被设定为0,我不明白,为什么它只是在花R超过1的时候才这样做。

我怀疑这是令人痛苦的简单现象,但我认为我的大脑 f。 非常感谢任何帮助。

最佳回答

UPDATE: I m a doofus. 所发生的事情是显而易见的。 估算首先确定了其目前立场的层次。 但是,我叫Ratio把任何固定的政治坐标分开。 因此,它不去CCGPoint(0,0),而是像CG Point(0.032,0)这样的东西。 我这样说:

- (void) setPosition:(CGPoint)point
{
    if(!animating){
        [super setPosition:CGPointMake(round(point.x / pRatio), round(point.y / pRatio))];
    }else{
        [super setPosition:point];
    }

}


- (void) gotoStartPosition:(NSNotification *)notification
{
    animating = YES;
    CGPoint startPos = CGPointFromString([notification object]);
    CGPoint pStart = CGPointMake(startPos.x / pRatio, startPos.y / pRatio);
    id moveToStart = [MoveTo actionWithDuration:1 position:pStart];
    id endAnim = [CallFunc actionWithTarget:self selector:@selector(endAnimation)];
    [self runAction:[Sequence actions: moveToStart, endAnim, nil]];
}

- (void) endAnimation
{
    animating = NO;
}

哪怕是leg,但却是行之有效的。 我结束这个问题。

问题回答

暂无回答




相关问题
images sliding continuously with <table> and jQuery

I m trying to write a little test page that circulates images through a window (see image). I have colored boxes inside a table (gray border), with each box being a element. <table id="boxes" ...

WPF 3d rotation animations

I have a few 3d rectangles on my screen that I want to pivot around the Y axis. I want to press down with the mouse, and rotate the 3d object to a max rotation, but when the user moves their mouse, ...

Disable Windows 7 touch animation in WPF

In Windows 7 when you touch the screen there is a short animation that occurs at the touch point. In my WPF app I want to display my own touch points, without showing the one supplied by Windows. ...

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Direct 2D gnuplot PNG animation?

Can anyone please confirm that yes/no Gnuplot 4.5 (on CVS) can output 2D animated PNG files? I have numerous datasets but one line that I d like to show iteratively in 3 different places in my graph. ...

Visual State Manager VS Animations in WPF

There is a lot of talk about the simplicity of Visual States and the transitions between them in WPF/Silverlight. I have the need to generate animations dynamically at runtime, to animate the ...

Create a ImageIcon that is the mirror of another one

I ll like to know if there is a way to create a ImageIcon that is the mirror of another ImageIcon. Searching on Google, I found how to do it by using many AWT libraries. Is there a way to do it with ...

how to drag in the animation in iphone application?

Iphone application is using the static co-ordinates to reach at some points in the application,which is based on the button event. But what i want is when i drag the item than it should reach at some ...

热门标签