Well I figured out *a* way to do this, but it seems wrong.  If I have
a sprite called "optimus" I can do this:

keepmovingleft = Repeat(MoveBy(-1, 0), 1))
optimus.do(keepmovingleft)

...which will make him move left forever.  Then I can stop him on key
release with this:

optimus.stop()

...but that makes him stop doing *all* his actions, not just the one
in question.  So if he was also rotating, he would stop that too.
This is not what I want.  So I also tried to do something like this:

optimus.do(keepmovingleft)
optimus.remove_action(keepmovingleft)

...but I can't get that to work the way I thought it would.  I think I
know why, but I'm not sure what else to do.  From the cocosnode code I
can see that optimus.do(keepmovingleft) adds an action to his actions
list by making a deep copy of keepmovingleft.  Then remove_action
(keepmovingleft) tries to compare keepmovingleft against the deep
copy, but that fails.  keepmovingleft != copykeepmovingleft.

So, what should I do here?  Is there a way to remove just the action I
want to remove?  Am I barking up the wrong tree entirely here?  I'm
sure I'm not the first person to try to do this, but I can't figure
out what the right way to do it is from the samples and docs.

Thanks!

David

On Apr 9, 4:50 pm, David <[email protected]> wrote:
> Hi everybody,
>
> In an action game you may have a sprite that will move around the
> screen while I'm holding the arrow keys and stop when I release them?
> Are actions appropriate for this?  I get the sense that they are not
> the right solution here.
>
> Thanks in advance for the help,
>
> David
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to