public override void TouchesEnded(List <CCTouch> touches, CCEvent event_) { //base.ccTouchesEnded(touches, event_); object it = touches.First(); CCTouch touch = (CCTouch)(it); CCPoint location = touch.LocationInView; CCPoint convertedLocation = CCDirector.SharedDirector.ConvertToGl(location); CCNode s = GetChildByTag(ClickAndMoveTest.kTagSprite); s.StopAllActions(); s.RunAction(new CCMoveTo(1, new CCPoint(convertedLocation.X, convertedLocation.Y))); float o = convertedLocation.X - s.Position.X; float a = convertedLocation.Y - s.Position.Y; float at = (float)(Math.Atan(o / a) * 57.29577951f); if (a < 0) { if (o < 0) { at = 180 + Math.Abs(at); } else { at = 180 - Math.Abs(at); } } s.RunAction(new CCRotateTo(1, at)); }
void onTouchesEnded(List <CCTouch> touches, CCEvent touchEvent) { //base.ccTouchesEnded(touches, event_); object it = touches.First(); CCTouch touch = (CCTouch)(it); var convertedLocation = touch.Location; CCNode s = this[ClickAndMoveTest.kTagSprite]; s.StopAllActions(); s.RunAction(new CCMoveTo(1, new CCPoint(convertedLocation.X, convertedLocation.Y))); float o = convertedLocation.X - s.Position.X; float a = convertedLocation.Y - s.Position.Y; float at = (float)(Math.Atan(o / a) * 57.29577951f); if (a < 0) { if (o < 0) { at = 180 + Math.Abs(at); } else { at = 180 - Math.Abs(at); } } s.RunAction(new CCRotateTo(1, at)); }
public void bugMe(CCNode node) { node.StopAllActions(); //After this stop next action not working, if remove this stop everything is working node.RunAction(new CCScaleTo(2, 2)); }
public void RunAnimationsForSequenceIdTweenDuration(int nSeqId, float fTweenDuration) { Debug.Assert(nSeqId != -1, "Sequence id couldn't be found"); _rootNode.StopAllActions(); foreach (var pElement in _nodeSequences) { CCNode node = pElement.Key; node.StopAllActions(); // Refer to CCBReader::readKeyframe() for the real type of value Dictionary <int, Dictionary <string, CCBSequenceProperty> > seqs = pElement.Value; var seqNodePropNames = new List <string>(); Dictionary <string, CCBSequenceProperty> seqNodeProps; if (seqs.TryGetValue(nSeqId, out seqNodeProps)) { // Reset nodes that have sequence node properties, and run actions on them foreach (var pElement1 in seqNodeProps) { string propName = pElement1.Key; CCBSequenceProperty seqProp = pElement1.Value; seqNodePropNames.Add(propName); SetFirstFrame(node, seqProp, fTweenDuration); RunAction(node, seqProp, fTweenDuration); } } // Reset the nodes that may have been changed by other timelines Dictionary <string, object> nodeBaseValues; if (_baseValues.TryGetValue(node, out nodeBaseValues)) { foreach (var pElement2 in nodeBaseValues) { if (!seqNodePropNames.Contains(pElement2.Key)) { object value = pElement2.Value; if (value != null) { SetAnimatedProperty(pElement2.Key, node, value, fTweenDuration); } } } } } // Make callback at end of sequence CCBSequence seq = GetSequence(nSeqId); CCAction completeAction = new CCSequence( new CCDelayTime(seq.Duration + fTweenDuration), new CCCallFunc(SequenceCompleted) ); _rootNode.RunAction(completeAction); // Set the running scene if (seq.CallBackChannel != null) { CCAction action = (CCAction)ActionForCallbackChannel(seq.CallBackChannel); if (action != null) { _rootNode.RunAction(action); } } if (seq.SoundChannel != null) { CCAction action = (CCAction)ActionForSoundChannel(seq.SoundChannel); if (action != null) { _rootNode.RunAction(action); } } _runningSequence = GetSequence(nSeqId); }