On Wed, Sep 10, 2008 at 7:18 AM, Poldy <[EMAIL PROTECTED]> wrote: > > Hello! > > I want to write a game (not suprising....) and I want to use cocos2d > for it (you guessed so). The game is something like a tower defence > game (ie. little critters try to invade, you build towers to defend > against them). > > Of course cocos2d lacks some things I need and I thought I write them > so they can be useful to others, either as an add-on or as an addition > to cocos2d itself. I need a path-calculating algorithm and an action > that moves a sprite along the calculated path. The whole thing should > be like a framework: the algorithm should be exchangeable (for the > beginning I will use A*), the cost-calculating should be done via a > call-back to have a maximum flexibility. - This is the easier part. > > The next one is about the action that will move the sprite along the > path. The most complicated aspect (in my eyes) is, how to implement a > change in movement. This may be a slow-effect (ie. due to hits taken) > or the little critter dies. I would like to implement the whole stuff > into a single (configurable) action. > > Since I'm fairly new to cocos2d I would like some comments on my > plans. Some input on needs of other users, interested to use a path- > alorithm and/or action, would be good too. >
For this i would not use actions, because action are more like 'fire-and-forget' but id do some step function in the object that has its current world position and its desired world position and calculates a path to that and interpolates the next position based on the speed you want the thing to have and the path it found. (with suitable cacheing to avoid calculating the path every frame, of course) for an example of how to follow a path, take a look at the Bezier action. regards, Lucio. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
