I want to go through three parts, only the last one really moves I think Easy actions
I can not "recycle"
How is this done correctly?
- init {// Initial setup [self-driving form]; } - (empty) transfer {ID verb = [duration with CCM proceeding: 1 position: CCP (0,160)]; ID Ease = [CCEC Inactive Action Auth Action: Action]; [Part run 1 action: rest]; [Part 2 action: rest]; [Part 3 action: rest]; }
It seems that there is a problem in allocating and copying this action object The answer to my question very well, with the summary of this post:
With my experience you can not really retain the tasks and get any benefit from them.
There really is not a good way to reuse the action if you think that you are too much deallocing that the game is shaky then you should forget the action and just one way that all works Is the schedule.
Examples (all variable classes ending with an underscore are variable variables "variablename_"):
Poor way to run an action:
.... maybe init moveAction_ = [[MoveBy actionWithDuration: 1.f position: CCP (100.F, 0.F)]; .... some other functions [sprite1_ runAction: moveAction_]; [Sprite 2_Action: move action_];
This example will not work because both phantom 1_, sprite2_ let's say that there is only one condition. They will not run together! The reason for this is that the action has been referred by an action manager and you have only changed the goal of that action.
Correct way:
... possibly init moveAction_ = [[MoveBy actionWithDuration: 1.f position: CCP (100.F, 0. F)] maintained]; .... some other function [sprite1_ runAction: [[moveAction_ copy] autorelease]]; [Sprite 2 Action Actions: [[Action Action] copy)];
Now the action will be the correct behavior, but you have lost the full efficiency of keeping one at the first place. You have made two new Institutions of Action very much.
The above code is exactly the same:
[sprite1_ runAction: [Action step by step: 1.f position: CCP (100. F, 0. F)]]; [Sprite 2_Action: [Action with Action in Action: 1. F Position: CCP (100.F, 0.F)]];
Finally, if you have not got any benefit to keep the action, then why are you persuaded?
If you are really worried about slowing down the game then on the other hand, to stay away from the facility of action and take your own scheduled action
... Anywhere init [auto scheduling: @sillector (hillstuff :)]; // You do all the work manually here - (zero) move: (CCTC) DT {CGPoint Delta = CCP (100.F, 0.F); Sprite1.position = CCP ((sprite1.position.x + delta.x * dt), (sprite1.position.y + delta.y * dt)); }
So it is up to you that you can decide between speed or convenience
Comments
Post a Comment