<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.2" -->
<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; Topic: Proper way of handling movement of enemies.</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/27832</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Sun, 19 May 2013 12:56:06 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.2</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/topic/27832" rel="self" type="application/rss+xml" />

		<item>
			<title>wadevondoom on "Proper way of handling movement of enemies."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27832#post-136728</link>
			<pubDate>Fri, 23 Dec 2011 17:53:50 +0000</pubDate>
			<dc:creator>wadevondoom</dc:creator>
			<guid isPermaLink="false">136728@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Check this out: <a href="http://geekanddad.wordpress.com/2010/06/22/enemies-and-combat-how-to-make-a-tile-based-game-with-cocos2d-part-3/" rel="nofollow">http://geekanddad.wordpress.com/2010/06/22/enemies-and-combat-how-to-make-a-tile-based-game-with-cocos2d-part-3/</a></p>
<p>It's from version 0/99 something but the core of it is sound.
</p></description>
		</item>
		<item>
			<title>CS on "Proper way of handling movement of enemies."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27832#post-136724</link>
			<pubDate>Fri, 23 Dec 2011 17:29:06 +0000</pubDate>
			<dc:creator>CS</dc:creator>
			<guid isPermaLink="false">136724@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a question regarding the code design of some npc's i am adding to a game i am working on.<br />
The NPC is subclassed from CCNode, and in there i have some variables together with the the move methods:<br />
_body is of class, CCSprite.</p>
<pre><code>-(void) movementLogic:(ccTime) dt
{
    CGPoint moveTo = CGPointMake(CCRANDOM_0_1() * 200 - 100, 0);
    [self logicRun:2.0f position:moveTo];
}
-(void) logicRun:(float) duration position:(CGPoint) moveTo
{
    CCMoveBy *move = [CCMoveBy actionWithDuration:duration position:moveTo];
    [_body runAction:move];
}</code></pre>
<p>In a scene i am testing it on i add a few based on spawn locations from Tiled:<br />
<pre><code>- (void) addNPCAtX:(int)x Y:(int) y Type:(int)type
{
    NPC *npcClass = [NPC npcWithParentNode:self];
    npcClass.position = ccp(x,y);
}</code></pre>
<p>They do appear, but they don't move. I also have a feeling that i am not in control of them, in case of later use where i need to do some collision detection.<br />
Could someone point out, what I might be doing wrong? Thanks for the time guys.
</p></description>
		</item>

	</channel>
</rss>
