Commits

Andres Vargas committed 98042d2

moviento 2

Comments (0)

Files changed (1)

 	}
 	this._timer = function () {
 		var i = 0;
-		if( e.esperm) {
-			e.timerId = setInterval(function (){
-				if( !e.is_lock  ) {
+		if( !e.esperm ) {
+			console.log("corre primera vez esperm");
+			e._array_images.translate(e.pos[x], e.pos[y]);
+			e.esperm = e.get_esperm(i);
+			i++;
+			e.is_lock = false;
+		}
+		e.timerId = setInterval(function (){
+				console.log("esperme lock", e.is_lock );
+				if( e.is_lock  == false ) {
 					if( i > 14 ) {
 						i= 0;
 					}	
 					i++;
 				}
 			}, TIMER);
-		}
+
 	}
 	this.update = function (pos) {
 		if(  e.esperm != undefined ) {
 		e.pos = pos;
 		e.pos[y] = e.pos[y] - (e.HEIGHT);
 		e.pos[x] = e.pos[x] - 10;
-		console.log("pos",e.pos);
+		console.log("posicion para update ",e.pos);
 		clearInterval(e.timerId);
 		if( e.old_pos == null ) {
 			e.old_pos = pos;
 		e._timer();
 	}
 	this.draw = function () {	
-		e.is_lock = true;
 		pos = e.pos;
 		old_pos = e.old_pos;
-		if( e.esperm ) {
-			e._array_images.animate({x:pos[x], y:pos[y]},2000, function() {
-				e.is_lock = true;
-			});
+		if( e.esperm == undefined ) return 
+		e._array_images.animate({x:pos[x], y:pos[y]},2000, function() {
+				console.log("termina moviento a", pos)
+		});
 		e.old_pos = pos;
 	}
 	this.rotate = function(){};
 		if( e.pos &&  !e.is_lock) {
 			var 	pos_inicial = e.pos;
 			var	pos_mouse = pos;
-			//var	pos_terc = [ pos_inicial[x]+100, pos_inicial[y]];
 			// show angle
 			//new Line(canvas, pos_inicial, pos_mouse,"green");
 			var angle = Raphael.angle( 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.