Commits

Anonymous committed 8474237

use an array of string for a play action; this permits movement and sequence notification

  • Participants
  • Parent commits 34e8f73

Comments (0)

Files changed (2)

 "use strict";
 
 define( function() {
-    var ActionNode = function(key, action, timing) {
-        this.action = action;
+    var ActionNode = function(key, actions, timing) {
+        this.actions = actions;
         this.timing = timing ? timing : {expiration:15, recovery:0};
         this.looped = undefined;
         this.branch = {};
         this.get = function( key ) {
             return this.branch[key];
         }
-        this.add = function( key, action, timing ) {
-            var newNode = new ActionNode(key, action, timing);
+        this.add = function( key, actions, timing ) {
+            var newNode = new ActionNode(key, actions, timing);
             this.branch[key] = newNode;
             return newNode;
         }
 
         function notifyThenNext() {
             thisAction.getTiming(actionTime);
-            actionDelegate.firePlayAction.apply(actionDelegate, [thisAction.action]);
+            thisAction.actions.forEach( function(action) {
+                actionDelegate.firePlayAction.apply(actionDelegate, [action]);
+            });
             return thisAction.looped ? thisAction.looped : thisAction;
         }
 
         if( state ) {
             var rootAction = input.getRootAction();
             rootAction.clear();
-            rootAction.add(1, "RIGHT");
-            rootAction.add(3, "LEFT").add(1,"RIGHT").add(3,"LEFT").add(1,"COMBO");
-            rootAction.add(2, "UP");
-            rootAction.add(4, "DOWN");
+            rootAction.add(1, ["RIGHT"]);
+            rootAction.add(3, ["LEFT","COMBO_START"])
+                .add(3,["LEFT"])
+                .add(1,["RIGHT"])
+                .add(1,["RIGHT"])
+                .add(1,["RIGHT"])
+                .add(1,["RIGHT"])
+                .add(3,["LEFT"])
+                .add(3,["LEFT"])
+                .add(5,["JUMP","COMBO_END"]);
+            rootAction.add(2, ["UP"]);
+            rootAction.add(4, ["DOWN"]);
         }
         else {
             var rootAction = input.getRootAction();
             rootAction.clear();
-            rootAction.add(1, "RIGHT");
-            rootAction.add(3, "LEFT");
-            rootAction.add(2, "UP");
-            rootAction.add(4, "DOWN");
+            rootAction.add(1, ["RIGHT"]);
+            rootAction.add(3, ["LEFT"]);
+            rootAction.add(2, ["UP"]);
+            rootAction.add(4, ["DOWN"]);
         }
         playerObjects.rerender();
     }
     }
 
     var that = {
-        mapPosition:{x:26,y:32},
+        //mapPosition:{x:26,y:32},
+        mapPosition:{x:33, y:4},
         isExtracted: false,
         firePlayAction: function(action) {
             if( that.isExtracted ) {
     input.setActionDelegate(that);
     var rootAction = input.getRootAction();
     rootAction.clear();
-    rootAction.add(1, "RIGHT");
-    rootAction.add(3, "LEFT");
-    rootAction.add(2, "UP");
-    rootAction.add(4, "DOWN");
+    rootAction.add(1, ["RIGHT"]);
+    rootAction.add(3, ["LEFT"]);
+    rootAction.add(2, ["UP"]);
+    rootAction.add(4, ["DOWN"]);
     input.playInput.enable();
 
     return that;