<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: actions - Recent Posts</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/actions</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 02:52:19 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/actions" rel="self" type="application/rss+xml" />

		<item>
			<title>lynerd on "Sprite Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28755#post-141770</link>
			<pubDate>Sun, 29 Jan 2012 19:41:55 +0000</pubDate>
			<dc:creator>lynerd</dc:creator>
			<guid isPermaLink="false">141770@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I think is the latter. I was just loading Icon.png for some testing, but when I loaded my own sprite with a 2 pixel transparent border it looks better.
</p></description>
		</item>
		<item>
			<title>LittleBitStudio on "Sprite Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28755#post-141766</link>
			<pubDate>Sun, 29 Jan 2012 19:19:22 +0000</pubDate>
			<dc:creator>LittleBitStudio</dc:creator>
			<guid isPermaLink="false">141766@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is the movement jittery or are you seeing the partial pixel rendering on the edges and it looks rough?
</p></description>
		</item>
		<item>
			<title>lynerd on "Sprite Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28755#post-141755</link>
			<pubDate>Sun, 29 Jan 2012 17:16:38 +0000</pubDate>
			<dc:creator>lynerd</dc:creator>
			<guid isPermaLink="false">141755@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for the info on stringing Actions! That seems to help a bit with the non-smoothness of the movement. Also it will make it easier later when I want to add collision detection to the Entity.</p>
<p>As far as the jerkiness of the sprite I found, by some more searching, that if you dont have a empty transparent border around your sprite, then it will be jittery as it moves.
</p></description>
		</item>
		<item>
			<title>LittleBitStudio on "Sprite Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28755#post-141746</link>
			<pubDate>Sun, 29 Jan 2012 16:01:36 +0000</pubDate>
			<dc:creator>LittleBitStudio</dc:creator>
			<guid isPermaLink="false">141746@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Sorry, looking at it longer ... the way the code is written, the first call to moveInDirection: will perform the move. The _moving stays set even when the action is finished, unless you call moveInDirection again. But the 2nd call will reset _moving if the position is right, but it won't perform a move because you reset it after the check to see if its moving. Try moving the if-block with _moving = NO; to the top of the method to see if it helps fix your problem. However, your _moving flag will always be YES outside of the method once you've moved one time, but it should at least work internally to see if you can move again.</p>
<p>btw, rather than checking to see if you're object is where is supposed to be when the action is completed, I'd code it so the action notifies you when its done. This way, you're ensured the move action completed, and your _moving state is always correct. </p>
<p>#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> MOVE_ACTION_TAG 7000</p>
<p>-(void)moveTo:(CGPoint)_point withDuration:(float)_duration<br />
{<br />
[self stopActionByTag:MOVE_ACTION_TAG];</p>
<p>_moving = YES;</p>
<p>CCMoveTo *move = [CCMoveTo actionWithDuration:_duration position_point];<br />
CCCallFuncN *call = [CCCallFuncN actionWithTarget:self selector:@selector(moveCompleted:)];<br />
CCSequence *sequence = [CCSequence actions:move, call, nil];<br />
[sequence setTag:MOVE_ACTION_TAG];<br />
[self runAction:sequence];<br />
}</p>
<p>-(void)moveCompleted:(id)_sender<br />
{<br />
_moving = NO;<br />
}</p>
<p>Then to use it:</p>
<p>if(direction == kDirectionNorth)<br />
{<br />
[self moveTo:ccp(self.position.x, self.position.y - _distance) withDuration:_duration];<br />
}
</p></description>
		</item>
		<item>
			<title>lynerd on "Sprite Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28755#post-141743</link>
			<pubDate>Sun, 29 Jan 2012 15:12:48 +0000</pubDate>
			<dc:creator>lynerd</dc:creator>
			<guid isPermaLink="false">141743@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>All the movement functionality is in the moveInDirection function I posted.</p>
<p>I have a bool called _moving that is either YES or NO. The variable _distance is an int with the point distance I want the sprite to move. The variable _duration is a float that equals how long I want the move to take. I just used variables so I didn't have to hard code in 32 pixels or 1.5 seconds into the action.</p>
<p>-If the function is called and _moving is NO then I set it to YES and call an action on the sprite. There is no queueing at all.<br />
-If the function is called and and _moving is YES then it checks if the sprites position is equal to the _newPosition of where it should be moving to. If they are equal then I set _moving to NO.</p>
<p>That is about all and I will look into queueing for my actions. Thanks for that info.</p>
<p>Any ideas on the "jittery" movement? As the sprite moves across the screen it isn't always smooth. Instead it will kinda jiggle in place every once in awhile.
</p></description>
		</item>
		<item>
			<title>Leo on "[Tool] Export timeline animations from Adobe Flash and import as Cocos2d Actions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6239#post-141715</link>
			<pubDate>Sun, 29 Jan 2012 07:31:00 +0000</pubDate>
			<dc:creator>Leo</dc:creator>
			<guid isPermaLink="false">141715@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks Yeomin! This is a time saver. :)
</p></description>
		</item>
		<item>
			<title>LittleBitStudio on "Sprite Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28755#post-141704</link>
			<pubDate>Sun, 29 Jan 2012 05:08:59 +0000</pubDate>
			<dc:creator>LittleBitStudio</dc:creator>
			<guid isPermaLink="false">141704@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>How are you stringing the movements together? ie. where are you checking the _moving to determine when to perform the next move?</p>
<p>Here's a suggestion on getting a callback once the move is completed and you're ready for the next move, something like this:</p>
<p>CCMoveBy *move = [CCMoveBy actionWithDuration:_duration position:ccp(-_distance, 0)];<br />
CCCallFuncN *call = [CCCallFuncN actionWithTarget:self selector:@selector(moveCompleted:)];<br />
[self runAction:[CCSequence actions:move, call, nil]];</p>
<p>I assume its just between actions ... and your _distance and _duration are proportional to each other so that each move is relatively the same speed. Do you have the individual moves stored in a queue so that they can be quickly executed as possible?
</p></description>
		</item>
		<item>
			<title>lynerd on "Sprite Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28755#post-141701</link>
			<pubDate>Sun, 29 Jan 2012 03:58:09 +0000</pubDate>
			<dc:creator>lynerd</dc:creator>
			<guid isPermaLink="false">141701@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I set up an Actor class that will act as the base for all my entities in my game. I want the sprite to move in only one direction at a time and from tile to tile, example being the pokemon games. I got all of that working fine, but there a few problems I am running into.</p>
<p>-When the sprite is moving, it sometimes gets "jittery" as it moves along its action path. This is in the simulator and on my iphone 3gs.</p>
<p>-Also, since I am using an action to move the sprite, I can't get a continuous movement. Actions do not flow well into the next move action. It moves the correct number of pixels, but then stops and starts again. It looks very jerky.</p>
<p>Any tips or help would be appreciated. Here is my movement code:<br />
<pre><code>typedef enum {
    kDirectionNone,
    kDirectionSouth,
    kDirectionWest,
    kDirectionNorth,
    kDirectionEast
} Direction;

-(void) moveInDirection:(Direction)direction
{
    if(!_moving)
    {
        _oldPosition = self.position;
        _moving = YES;

        if(direction == kDirectionNorth)
        {
            [self runAction:[CCMoveBy actionWithDuration:_duration position:ccp(0, -_distance)]];
            _newPosition = ccp(self.position.x, self.position.y - _distance);
        }
        else if(direction == kDirectionSouth)
        {
            [self runAction:[CCMoveBy actionWithDuration:_duration position:ccp(0, _distance)]];
            _newPosition = ccp(self.position.x, self.position.y + _distance);
        }
        else if(direction == kDirectionWest)
        {
            [self runAction:[CCMoveBy actionWithDuration:_duration position:ccp(-_distance, 0)]];
            _newPosition = ccp(self.position.x - _distance, self.position.y);
        }
        else if(direction == kDirectionEast)
        {
            [self runAction:[CCMoveBy actionWithDuration:_duration position:ccp(_distance, 0)]];
            _newPosition = ccp(self.position.x + _distance, self.position.y);
        }
    }

    if(self.position.x == _newPosition.x &#38;&#38; self.position.y == _newPosition.y)
    {
        _moving = NO;
    }
}</code></pre></description>
		</item>
		<item>
			<title>Yeomin on "[Tool] Export timeline animations from Adobe Flash and import as Cocos2d Actions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6239#post-141691</link>
			<pubDate>Sun, 29 Jan 2012 01:29:13 +0000</pubDate>
			<dc:creator>Yeomin</dc:creator>
			<guid isPermaLink="false">141691@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>Here is my converted code, working on cocos2d-1.0.1-x-0.11.0. </p>
<p><a href="http://db.tt/kA0jr0gL" rel="nofollow">http://db.tt/kA0jr0gL</a></p>
<p>Thank you,<br />
Yeomin
</p></description>
		</item>
		<item>
			<title>zzt4 on "Graphical glitch using per-character animation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28666#post-141439</link>
			<pubDate>Fri, 27 Jan 2012 00:10:24 +0000</pubDate>
			<dc:creator>zzt4</dc:creator>
			<guid isPermaLink="false">141439@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Found the culprit... Seems to be a glitch in the CCMoveBy function that only affects characters within a label...
</p></description>
		</item>
		<item>
			<title>zzt4 on "Graphical glitch using per-character animation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28666#post-141357</link>
			<pubDate>Thu, 26 Jan 2012 14:24:04 +0000</pubDate>
			<dc:creator>zzt4</dc:creator>
			<guid isPermaLink="false">141357@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Also, why aren't the image tags working in the forum?
</p></description>
		</item>
		<item>
			<title>zzt4 on "Graphical glitch using per-character animation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28666#post-141263</link>
			<pubDate>Wed, 25 Jan 2012 21:22:52 +0000</pubDate>
			<dc:creator>zzt4</dc:creator>
			<guid isPermaLink="false">141263@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am currently animating each character in a CCLabelBMFont. Sometimes when the animation finishes, the label can end up looking weird. Anyone have any ideas what could be causing this?</p>
<pre><code>double totalTime = 1.0f;
int currentCharIndex = 0;
CCMenu* _menu = (CCMenu*)[self getChildByTag:kNodeTagLabelMenu];
CCNode* _node;
CCARRAY_FOREACH([_menu children], _node) {
    CCNode* _labelNode;
    CCARRAY_FOREACH([_node children], _labelNode) {
        double individualTime = totalTime / [[_labelNode children] count];
        CCNode* _charNode;
        CCARRAY_FOREACH([_labelNode children], _charNode) {
            _charNode.scale = 0.5;
            [_charNode runAction:[CCSequence actions:[CCDelayTime actionWithDuration:individualTime * currentCharIndex],
                                                     [CCSpawn actions:[CCScaleTo actionWithDuration:0.1f scale:1.0],
                                                                      [CCFadeIn actionWithDuration:0.1f],
                                                                      [CCMoveBy actionWithDuration:0.1f position:ccp(0, -20)],
                                                                      nil],
                                                     nil]];

            currentCharIndex++;
        }
        currentCharIndex = 0;
    }
}</code></pre>
<p>The animation always runs successfully and looks great.<br />
However, sometimes the end of the animation looks like this: (yay!)<br />
[IMG]http://i42.tinypic.com/330xquc.jpg[/IMG]</p>
<p>And then sometimes it looks like this: (boo!)<br />
[IMG]http://i42.tinypic.com/ohllc0.jpg[/IMG]
</p></description>
		</item>
		<item>
			<title>Yeomin on "[Tool] Export timeline animations from Adobe Flash and import as Cocos2d Actions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6239#post-140815</link>
			<pubDate>Mon, 23 Jan 2012 12:52:54 +0000</pubDate>
			<dc:creator>Yeomin</dc:creator>
			<guid isPermaLink="false">140815@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I find animation tool for cocos2d-x. This is very good for me.</p>
<p>I converted original code to C++ over cocos2d-x.</p>
<p>If approved put converted code, I will upload it.</p>
<p>Thank you,<br />
Yeomin
</p></description>
		</item>
		<item>
			<title>hgeghamyan on "[Tool] Export timeline animations from Adobe Flash and import as Cocos2d Actions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6239#post-140372</link>
			<pubDate>Fri, 20 Jan 2012 09:25:45 +0000</pubDate>
			<dc:creator>hgeghamyan</dc:creator>
			<guid isPermaLink="false">140372@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi !!!<br />
I want to thank for great job. I use it and it's really cool.<br />
But I have one question. Is it possible to add skewX and skewY animations? I have complicated animation with skews.</p>
<p>Thanks a lot<br />
Hayk
</p></description>
		</item>
		<item>
			<title>NOG on "Vertical black line artifacts when using CCMoveTo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28040#post-137991</link>
			<pubDate>Wed, 04 Jan 2012 17:37:58 +0000</pubDate>
			<dc:creator>NOG</dc:creator>
			<guid isPermaLink="false">137991@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I got it! </p>
<p>There's an update function in CCActionInterval.m</p>
<p>I changed </p>
<p><code>[target_ setPosition: ccp( (startPosition.x + delta.x * t ), (startPosition.y + delta.y * t ) )];</code></p>
<p>to</p>
<p><code>[target_ setPosition: ccp(floor(startPosition.x + delta.x * t ), floor(startPosition.y + delta.y * t ) )];</code></p>
<p>Since anti aliasing was turned off anyway, this places things in non-decimal positions, getting rid of artifacts.
</p></description>
		</item>
		<item>
			<title>NOG on "Vertical black line artifacts when using CCMoveTo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28040#post-137988</link>
			<pubDate>Wed, 04 Jan 2012 17:19:14 +0000</pubDate>
			<dc:creator>NOG</dc:creator>
			<guid isPermaLink="false">137988@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I don't know what you mean by "images" since the problem is mainly with the tiles, but I tried self.scaleX = 1.04 and it looks even more messed up. I even tried just the map. But thanks for the suggestion.</p>
<p>araker, thanks for the suggestion for turning off subpixel rendering, but it still has the same behavior.
</p></description>
		</item>
		<item>
			<title>DifferentSparks on "Vertical black line artifacts when using CCMoveTo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28040#post-137831</link>
			<pubDate>Tue, 03 Jan 2012 21:58:21 +0000</pubDate>
			<dc:creator>DifferentSparks</dc:creator>
			<guid isPermaLink="false">137831@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Nog, just do it on the images with that problem once, try when you initialize. i solved in this way the same problem.
</p></description>
		</item>
		<item>
			<title>araker on "Vertical black line artifacts when using CCMoveTo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28040#post-137824</link>
			<pubDate>Tue, 03 Jan 2012 21:29:10 +0000</pubDate>
			<dc:creator>araker</dc:creator>
			<guid isPermaLink="false">137824@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Setting a 2D projection and disable subpixel rendering (in ccConfig.h) can help as well.
</p></description>
		</item>
		<item>
			<title>NOG on "Vertical black line artifacts when using CCMoveTo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28040#post-137813</link>
			<pubDate>Tue, 03 Jan 2012 20:16:05 +0000</pubDate>
			<dc:creator>NOG</dc:creator>
			<guid isPermaLink="false">137813@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Cool, really? Where do I do that? Here's my method to animate centering the map:</p>
<pre><code>-(void) centerScreenAsAction {
    // animate map centering as an action

    CGPoint screenCenterPos = [ScreenPos setCenterOfScreen:hero.heroSprite.position withMapWidth:theMap.mapSize.width withMapHeight:theMap.mapSize.height withTileWidth:theMap.tileSize.width withTileHeight:theMap.tileSize.height];

    id scrA1=[CCMoveTo actionWithDuration:.4 position:ccp(screenCenterPos.x,screenCenterPos.y)];

    [self runAction:[CCSequence actions:scrA1, nil]];   

}</code></pre></description>
		</item>
		<item>
			<title>DifferentSparks on "Vertical black line artifacts when using CCMoveTo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28040#post-137812</link>
			<pubDate>Tue, 03 Jan 2012 20:11:32 +0000</pubDate>
			<dc:creator>DifferentSparks</dc:creator>
			<guid isPermaLink="false">137812@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>image.scaleX = 1.04;
</p></description>
		</item>
		<item>
			<title>NOG on "Vertical black line artifacts when using CCMoveTo"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28040#post-137799</link>
			<pubDate>Tue, 03 Jan 2012 19:08:47 +0000</pubDate>
			<dc:creator>NOG</dc:creator>
			<guid isPermaLink="false">137799@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Earlier I had problems with tiles and sprites creating unsightly artifacts (like black vertical lines) and I learned that it was caused by floating point rounding issues. So, my solution was to get the floor values for new tile/sprite positions so they lay perfectly on a pixel, and also add [_soilSprite.texture setAliasTexParameters] to every sprite class.  </p>
<p>Now I have the same issue with moving the entire map with CCMoveTo. It's necessary to use this action because my update action is paused.  The problem is that I have no idea how to prevent CCMoveTo placing tiles "in between pixels" while it's animating. I'd rather have it floor new coordinates while animating so it doesn't do this. Any ideas? Thanks.
</p></description>
		</item>
		<item>
			<title>fireblink on "CCDirector,notificationNode problem with actions."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27916#post-137114</link>
			<pubDate>Wed, 28 Dec 2011 20:18:38 +0000</pubDate>
			<dc:creator>fireblink</dc:creator>
			<guid isPermaLink="false">137114@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks man! Now everything is working! Me happy :)
</p></description>
		</item>
		<item>
			<title>araker on "CCDirector,notificationNode problem with actions."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27916#post-137113</link>
			<pubDate>Wed, 28 Dec 2011 20:11:42 +0000</pubDate>
			<dc:creator>araker</dc:creator>
			<guid isPermaLink="false">137113@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I see what the problem is, the notification node isn't part of the scene graph, so its onEnter method isn't called automatically. onEnter sets the paused property to NO and actions only run on unpaused objects. </p>
<p>So in your init call [self onEnter]; before running the action.</p>
<p>This should be documented, thanks for pointing it out.
</p></description>
		</item>
		<item>
			<title>fireblink on "CCDirector,notificationNode problem with actions."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27916#post-137110</link>
			<pubDate>Wed, 28 Dec 2011 19:30:46 +0000</pubDate>
			<dc:creator>fireblink</dc:creator>
			<guid isPermaLink="false">137110@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>&#62;You can test that by putting a CCLOG in the dealloc method.</p>
<p>I've just added a dealloc method and it's not called.</p>
<p>&#62;Can you also post how you're initialing this class?</p>
<p>Sure, in AppDelegate -&#62; applicationDidFinishLaunching I add next:<br />
<pre><code>[TTNotificationNode node];</code></pre>
<p>and in TTNotificationNode -&#62; init:<br />
<pre><code>//register notification node
 [[CCDirector sharedDirector] setNotificationNode:self];</code></pre></description>
		</item>
		<item>
			<title>araker on "CCDirector,notificationNode problem with actions."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27916#post-137109</link>
			<pubDate>Wed, 28 Dec 2011 19:11:58 +0000</pubDate>
			<dc:creator>araker</dc:creator>
			<guid isPermaLink="false">137109@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Weird, I just posted on your previous thread, there seems nothing wrong with it. Just to be sure I'll delete that one. Here's my reply.. </p>
<p>I think you're over releasing the notification node and that it is created and destroyed again every frame. That's why a one time action like CCCallFunc works, but a action with a duration doesn't.</p>
<p>You can test that by putting a CCLOG in the dealloc method.</p>
<p>Can you also post how you're initialing this class?
</p></description>
		</item>
		<item>
			<title>fireblink on "CCDirector,notificationNode problem with actions."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27916#post-137058</link>
			<pubDate>Wed, 28 Dec 2011 08:51:37 +0000</pubDate>
			<dc:creator>fireblink</dc:creator>
			<guid isPermaLink="false">137058@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everybody! Sorry for repost, but it seams that my previous thread was corrupted :( I'm not able to post anything there, it shows that last poster was riq (but no messages from him), when I try to change message I get that thread not found. So I decided to repost it.</p>
<p>So, my problem:</p>
<p>Recently I've decided to create my own notification system. Everything was fine until I needed to use some time dependent actions.<br />
They are not working for any node that is added to the notificationNode. CCMoveTo, CCFadeIn, CCDelayTime, etc...</p>
<p>But CCCallBlock is working. Maybe there is something I've missed up.</p>
<p>What I've done:</p>
<pre><code>@interface TTNotificationNode : CCNode
@end

#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;TTNotificationNode.h&#34;
@implementation TTNotificationNode

- (id) init
{
    if((self = [super init])){
        CGSize winSize = [[CCDirector sharedDirector] winSize];

        [self setContentSize:winSize];
        self.anchorPoint = CGPointMake(0.0f, 0.0f);

        //register notification node
        [[CCDirector sharedDirector] setNotificationNode:self];

       //add some sprite
        CCSprite * notification = [CCSprite spriteWithFile:@&#34;notification_background.png&#34;];
        notification.anchorPoint = CGPointMake(0.5f, 1.0f);
        notification.position = CGPointMake(winSize.width/2, winSize.height/2);
        [self addChild:notification];

        //call some block
        [notification runAction:[CCCallBlock:^{
            CCLOG(@&#34;DA BOOM!&#34;);
        }];

        //move it
        [notification runAction:[CCMoveBy actionWithDuration:2.0f position:CGPointMake(250, 250)]];
    }
    return self;
}
@end</code></pre>
<p>I'm using v1.1
</p></description>
		</item>
		<item>
			<title>clarus on "Accessing an action by tag in Cocos2D."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27908#post-137049</link>
			<pubDate>Wed, 28 Dec 2011 05:23:00 +0000</pubDate>
			<dc:creator>clarus</dc:creator>
			<guid isPermaLink="false">137049@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>In the code above, the action was autoreleased after your init method returned.</p>
<p>If the sprite were performing the action, you could retrieve it using the getActionByTag method:</p>
<p><code>myAction = [mySprite getActionByTag: 12345];</code></p>
<p>but in the code above, the action is long gone.</p>
<p>You'll want to have the sprite run it or else retain it in an ivar or else create it when you need it rather than in your init method.
</p></description>
		</item>
		<item>
			<title>Heartbound on "Accessing an action by tag in Cocos2D."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27908#post-137031</link>
			<pubDate>Wed, 28 Dec 2011 00:25:05 +0000</pubDate>
			<dc:creator>Heartbound</dc:creator>
			<guid isPermaLink="false">137031@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have an action that I declared in the -init method.<br />
  -(id) init<br />
{<br />
        if( (self=[super init])) {<br />
            sprite = [CCSprite spriteWithFile:@"Icon@2x.png"];<br />
            sprite.position = ccp(150,150);<br />
            [self addChild:sprite];<br />
            sprite.tag = 13;<br />
            self.isTouchEnabled = YES;</p>
<p>            CCAction *anAction = [CCBlink actionWithDuration:5 blinks:10];<br />
            anAction.tag = 15;<br />
    }<br />
    return self;<br />
}</p>
<p>Now, I can access the sprite without any problems.<br />
-(void)ccTouchesBegan:(NSSet *)touch withEvent:(UIEvent *)event {</p>
<p>CCNode *node = [self getChildByTag:13];<br />
NSAssert([node isKindOfClass:[CCSprite class]],@"is NOT member of CCSprite");<br />
CCSprite *sprite = (CCSprite *)node;<br />
sprite.scale = CCRANDOM_0_1();</p>
<p>}</p>
<p>Now I don't know how to access my action via tag.. would anyone mind showing me a small example ?
</p></description>
		</item>
		<item>
			<title>tomdelonge on "Sprite action management (smoothly stopping and controlling actions)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27791#post-136531</link>
			<pubDate>Thu, 22 Dec 2011 03:33:53 +0000</pubDate>
			<dc:creator>tomdelonge</dc:creator>
			<guid isPermaLink="false">136531@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I've got some characters that will be on the screen that are a CCNode with several of their properties being the sprites (head, left_arm, body, etc.) I've got it part way working, but things don't run smoothly. When the stop() method is called, I'd want the person to slow down rather than completely stopping movement (it looks strange when the legs are in running/walking motion and the body stops moving and the legs go to standing position).</p>
<p>I'm just curious overall about how to have finer control over actions.</p>
<p>Here's my code so far:</p>
<pre><code>// Person.h
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;Foundation/Foundation.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@interface Person : CCNode {
    CCSprite* head;
    CCSprite* body;
    CCSprite* left_leg;
    CCSprite* right_leg;
    CCSprite* left_arm;
    CCSprite* right_arm;
    float scale;
}

enum {
    movementAnimation,
    headAnimation,
    leftArmAnimation,
    bodyAnimation,
    rightArmAnimation,
    leftLegAnimation,
    rightLegAnimation
};

-(void) walkRight;

@end

// Person.m
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;Person.h&#34;

@implementation Person

-(id) init
{
	if((self=[super init])) {
        self.position = ccp(0, 30);
        self.anchorPoint = ccp(0.5f, 0.5f);

        body = [CCSprite spriteWithSpriteFrameName:@&#34;body.png&#34;];
        body.position = ccp(0, 0);
        [self addChild:body z:5];

        left_arm = [CCSprite spriteWithSpriteFrameName:@&#34;arm_front.png&#34;];
        left_arm.anchorPoint = ccp(0.5f, 1);
        left_arm.position = ccp(-8, 6);
        [self addChild:left_arm z:10];

        right_arm = [CCSprite spriteWithSpriteFrameName:@&#34;arm.png&#34;];
        right_arm.anchorPoint = ccp(0.5f, 1);
        right_arm.position = ccp(8, 6);
        [self addChild:right_arm z:3];

        left_leg = [CCSprite spriteWithSpriteFrameName:@&#34;leg.png&#34;];
        left_leg.position = ccp(-3, -4);
        left_leg.anchorPoint = ccp(0.5f, 1);
        [self addChild:left_leg z: 8];

        right_leg = [CCSprite spriteWithSpriteFrameName:@&#34;leg_front.png&#34;];
        right_leg.position = ccp(4, -4);
        right_leg.anchorPoint = ccp(0.5f, 1);
        [self addChild:right_leg z:3];

        head = [CCSprite spriteWithSpriteFrameName:@&#34;head.png&#34;];
        head.anchorPoint = ccp(0.5f, 0);
        head.position = ccp(0, 6);
        [self addChild:head z: 8];

        [self scheduleUpdate];
    }
    return self;
}

-(void) update :(ccTime) dt
{
}

-(void) stop
{
    [self stopActionByTag:movementAnimation];
    [head stopActionByTag:headAnimation];
    [left_arm stopActionByTag:leftArmAnimation];
    [right_arm stopActionByTag:rightArmAnimation];
    [left_leg stopActionByTag:leftLegAnimation];
    [right_leg stopActionByTag:rightLegAnimation];

    CCAction *slow = [CCRotateTo actionWithDuration:0.5f angle:0];

    [head runAction:[[slow copy] autorelease]];
    [left_arm runAction:[[slow copy] autorelease]];
    [right_arm runAction:[[slow copy] autorelease]];
    [left_leg runAction:[[slow copy] autorelease]];
    [right_leg runAction:[[slow copy] autorelease]];
}

-(void) walkLeft
{

}

-(void) walkRight
{
    [self stop];
    CCAction *move = [CCMoveBy actionWithDuration:10 position:ccp(300, 0)];
    move.tag = movementAnimation;

    id headRotateLeft = [CCRotateTo actionWithDuration:0.4f angle:-3];
    id headRotateRight = [CCRotateTo actionWithDuration:0.4f angle:3];
    id headSequence = [CCSequence actions:headRotateLeft, headRotateRight, nil];
    CCAction *headRepeat = [CCRepeatForever actionWithAction:headSequence];
    headRepeat.tag = headAnimation;

    id leftArmRotateOut = [CCRotateTo actionWithDuration:0.4f angle:10];
    id leftArmRotateIn = [CCRotateTo actionWithDuration:0.4f angle:-18];
    id leftArmSequence = [CCSequence actions:leftArmRotateIn, leftArmRotateOut, nil];
    CCAction *leftArmRepeat = [CCRepeatForever actionWithAction:leftArmSequence];
    leftArmRepeat.tag = leftArmAnimation;

    id rightArmRotateOut = [CCRotateTo actionWithDuration:0.4f angle:-18];
    id rightArmRotateIn = [CCRotateTo actionWithDuration:0.4f angle:10];
    id rightArmSequence = [CCSequence actions:rightArmRotateIn, rightArmRotateOut, nil];
    CCAction *rightArmRepeat = [CCRepeatForever actionWithAction:rightArmSequence];
    rightArmRepeat.tag = rightArmAnimation;

    id leftLegRotateOut = [CCRotateTo actionWithDuration:0.4f angle:40];
    id leftLegRotateIn = [CCRotateTo actionWithDuration:0.4f angle:-15];
    id leftLegSequence = [CCSequence actions:leftLegRotateOut, leftLegRotateIn, nil];
    CCAction *leftLegRepeat = [CCRepeatForever actionWithAction:leftLegSequence];
    leftLegRepeat.tag = leftLegAnimation;

    id rightLegRotateOut = [CCRotateTo actionWithDuration:0.4f angle:15];
    id rightLegRotateIn = [CCRotateTo actionWithDuration:0.4f angle:-40];
    id rightLegSequence = [CCSequence actions:rightLegRotateIn, rightLegRotateOut, nil];
    CCAction *rightLegRepeat = [CCRepeatForever actionWithAction:rightLegSequence];
    rightLegRepeat.tag = rightLegAnimation;

    [head runAction:headRepeat];
    [left_arm runAction:leftArmRepeat];
    [right_arm runAction:rightArmRepeat];
    [left_leg runAction:leftLegRepeat];
    [right_leg runAction:rightLegRepeat];

    [self runAction:move];
}

@end</code></pre></description>
		</item>
		<item>
			<title>Karl on "Managing simple sprites moving off the screen (need to remove them)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27757#post-136398</link>
			<pubDate>Wed, 21 Dec 2011 05:37:12 +0000</pubDate>
			<dc:creator>Karl</dc:creator>
			<guid isPermaLink="false">136398@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Actions would make things a lot easier:</p>
<pre><code>- (void) spawnBird:(float) yPosition speed:(float) pixelsPerSecond
{
    CCSprite* bird = [CCSprite spriteWithFile:@&#34;bird.png&#34;];
    [self addChild:bird];

    CGPoint startPos = ccp(-bird.contentSize.width/2, yPosition);
    CGPoint endPos = ccp([Scene sceneWidth] + bird.contentSize.width/2, yPosition);

    bird.position = startPos;
    float duration = cppDistance(startPos, endPos) / pixelsPerSecond;
    [bird runAction:[CCSequence actions:
                     [CCMoveTo actionWithDuration:duration position:endPos],
                     [CCCallBlock actionWithBlock:^
                      {
                          [bird removeFromParentAndCleanup:YES];
                      }],
                     nil]];
}</code></pre></description>
		</item>

	</channel>
</rss>

