English 中文(简体)
COCOS2D:如何将砖瓦倒入电网
原标题:COCOS2D: how to animate falling bricks into a grid

在游戏开始时,我试图把41个砖.倒入一个6x7的电网,但迄今为止,我刚刚能够把砖瓦倒在同一个位置上。 如果我去除灭 an部分,所有砖块就出现在电网上。 砖瓦的碎块应 down倒在原砖之后的半或两块,以产生步骤的效果。

我知道,这是问题,但我不知道如何解决这一问题。

-(void)AnimateBricksFalling
{
    self.allowTouch = NO;
    for(int i =0; i< GRID_WIDTH ; i++)
    {
        for(int j =0; j< GRID_HEIGHT ; j++)
        {
            Bricks * d = grid[i][j];
            d.mySprite.position = ccp(168,1000); //the position is the issue, making all the bricks to fall down to the same position
            CCMoveTo *move = [CCMoveTo actionWithDuration:0.5 position:ccp(168,91)]; //the position is the issue, making all the bricks to fall down to the same position
            [d.mySprite runAction: move];
        }
    }
}
最佳回答

你们可以使用每个砖头的灯塔。

 [d.mySprite runAction: [d.mySprite runAction: [Sequence actions:
[DelayTime actionWithDuration: waitTime],
[CCMoveTo actionWithDuration:0.5 position:ccp(168,91)],
nil]]];

And then create an randon time and set it to the waitTime variable. Then each call will move one brick, then wait, and do it again.

希望!

问题回答

暂无回答




相关问题
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 ...

热门标签