Saving Actions of game
Cocos2d-JS v3-
rashasalahLikes 0Problem Description
please how to make the main menu ? that execute set of actions one after one
-
Sonar Systems adminLikes 0
-
rashasalahLikes 0
this sequence i have to define each node action and add it to the sequence action
but i want to make a function or array to save this action one after one and then after he finish selecting the actions user want begin to start the functions on the array
i tried the example in the link u shared but an error is appear uncaught exception: cc.Sequence.initWithTwoActions(): arguments must all be non nil
-
rashasalahLikes 0
thanks i have done it but first i want to make instanses if a nodeaction so when i make it to verify my concept i want to do it was like that
var imageFunc1 = function() { if (!t) { if(count==1){if(one) {nodeAction1 = cc.MoveBy.create(0.5, cc.p(x1,y1)); one=0;} else if (two) {nodeAction1 = cc.MoveBy.create(0.5, cc.p(x1,y1)); two=0;} else if (three) {nodeAction1 = cc.MoveBy.create(0.5, cc.p(x1,y1)); three=0;} else if (four) {nodeAction1 = cc.MoveBy.create(0.5, cc.p(x1,y1)); four=0;} } else if(count==2){if(one) {nodeAction2 = cc.MoveBy.create(0.5, cc.p(x1,y1)); one=0;} else if (two) {nodeAction2 = cc.MoveBy.create(0.5, cc.p(x1,y1)); two=0;} else if (three) {nodeAction2 = cc.MoveBy.create(0.5, cc.p(x1,y1)); three=0;} else if (four) {nodeAction2 = cc.MoveBy.create(0.5, cc.p(x1,y1)); four=0;} } else if(count==3){if(one) {nodeAction3 = cc.MoveBy.create(0.5, cc.p(x1,y1)); one=0;} else if (two) {nodeAction3 = cc.MoveBy.create(0.5, cc.p(x1,y1)); two=0;} else if (three) {nodeAction3 = cc.MoveBy.create(0.5, cc.p(x1,y1)); three=0;} else if (four) {nodeAction3 = cc.MoveBy.create(0.5, cc.p(x1,y1)); four=0;} } else if(count==4){if(one) {nodeAction4 = cc.MoveBy.create(0.5, cc.p(x1,y1)); one=0;} else if (two) {nodeAction4 = cc.MoveBy.create(0.5, cc.p(x1,y1)); two=0;} else if (three) {nodeAction4 = cc.MoveBy.create(0.5, cc.p(x1,y1)); three=0;} else if (four) {nodeAction4 = cc.MoveBy.create(0.5, cc.p(x1,y1)); four=0;} } } // actions[index++]=nodeAction1; else if(t) { sequenceAction = new cc.Sequence( nodeAction1, nodeAction2,nodeAction3,nodeAction4); score(); nimo.runAction( sequenceAction );
is that true or making an array is better ? but if making array better in your opinion help me beacause i cannot make Unfortunately
-
rashasalahLikes 0
i need our opinion first please for my previous question
second i need to calculate the score every time he moved from place to other but in the sequense action .. the nodeactions run one after one so the score is asynchronous with the movement action so how can i solve this problem where when the sequense action is running the score is calculated??
else if(t) { sequenceAction = new cc.Sequence( nodeAction1, nodeAction2,nodeAction3,nodeAction4); nimo.runAction( sequenceAction ); score(); // call the score one time }
-
Sonar Systems adminLikes 0
That option is fine, you can use an array or vector to make it more elegant
So do you want the score to be calculated in the sequence?
-
rashasalahLikes 0
sorry for being late for responce i had exams
i make the sequence action as u suggest for moving spirte from place to another but in itis path there is spirte that is friendly to increase score or another one which is harmful that decrease the score and after that disappear the friendly or harmful spirte during the taking path that he shoose for the sequence action
but the two actions which appear/disappear & sequence action and calculate score are seperatly from each other i want them to be connected together ?
how can i connect this action ?
(hint: my supervisor give me hint as every selecting action up/down/left/right save this action and check if there is a friendly/harmful spirit calculate score and disappear that spirite every click on the menuitem and not make this steps run until user click on play item ) so this hint is ok or not ?
if ok : how can to save all this actions with smal code as i will check all this steps for every click and save them in order and the other steps and perform it only on playing ?
if not ok : what is your opinion and how to make it ?
-
rashasalahLikes 0
another Question please :::
how making clone for spirit … i need to make a copy for menu items when selected in another place in the window???
-
Sonar Systems adminLikes 0
Define what you mean by connected?
-
rashasalahLikes 0
i mean to save each action for click and then when click playitem
the action will run and calculate the score and also check as i said if there is harmful/friendly spirit that will update the value of score and then the next action
-
rashasalahLikes 0
this is my senario game ::
For example, I have Nemo and sent to his father on his way in which a friend and enemy in different places and he starts pressing on buttons of the arraws one by one
In each button, he saves the event that he executes. For example, he chose four steps to reach his father when pressing on the start button the first step and calculate the score and make sure that there is no friend or enemy,then do the same for the three steps remaining
-
Sonar Systems adminLikes 0
OK, do you want this to persist after the application has been closed or only during the applications runtime?
-
rashasalahLikes 0
no i want during running my game or app
-
Sonar Systems adminLikes 0
Do you want the data to persist between scenes?
-
rashasalahLikes 0
no … can u give me an answer now ?
i have asked a question last thursday and i donnot have answer till now
-
Sonar Systems adminLikes 0
You need to store the actions in a vector, then loop over the vector running the actions.
Login to reply