So why when I try to grab ‘__scene’ in ‘__time.delayedCall ( )’, it is undefined, but right above it before that call when I call ‘console.log ( __scene );’, is the ‘__scene’ NOT undefined?
var __animComplete = function ( __scene, __camera, __entity, __time ) {
console.log ( __scene );
// Wait { x } millisecond{s} then call `callback` function
__time.delayedCall ( 1000, function ( __anim, __scene ) {
console.log ( __scene );
// Transition to `idle` state if needed
__stateMachine.transition ( 'move' );
}, [ GetAnimName ( __entity ) ], this );
// Wait { x } millisecond{s} then call `callback` function
__time.delayedCall ( 3000, function ( __anim, __scene ) {
console.log ( __scene );
__entity.setVelocityX ( __PLAYER_MAX_MOVESPEED );
// Wait { x } millisecond{s} then call `callback` function
__time.delayedCall ( 1000, function ( __anim, __scene ) {
console.log ( '__anim :: ' + __anim );
console.log ( '__scene :: ' + __scene );
__scene.stop ( );
}, [ GetAnimName ( __entity ) ], this );
}, [ GetAnimName ( __entity ) ], this );
}
this.__initializeWindow = function ( __objData ) {
__scene = __objData.scene;
__camera = __objData.camera;
__entity = __objData.entity;
__time = __objData.time;
__status = __objData.status;
if ( typeof ( $ ) !== null ) {
$ ( '<div></div>' ).appendTo ( 'body' )
.html ( '<div><h6>Would you like to try again?</h6></div>' )
.dialog ({
modal : true, title : 'Play Again?', zIndex : 10000,
autoOpen : true, width : 300, height : 250, resizable : false,
show : 'fade', hide : 'fade',
buttons : {
Yes : function ( ) {
$ ( this ).dialog ( 'close' );
__stateMachine.transition ( 'revive' );
__entity.on ( 'animationcomplete-revive', function ( ) {
__animComplete ( __scene, __camera, __entity, __time );
} );
},
No : function ( ) {
$ ( this ).dialog ( 'close' );
$ ( '<div></div>' ).appendTo ( 'body' )
.html ( '<div><h6>Are you sure?</h6></div>' )
.dialog ({
modal : true, title : 'Play Again?', zIndex : 10000,
autoOpen : true, width : 300, height : 250, resizable : false,
show : 'fade', hide : 'fade',
buttons : {
Yes : function ( ) {
$ ( this ).remove ( );
},
No : function ( ) {
$ ( this ).dialog ( 'close' );
__stateMachine.transition ( 'death' );
},
},
close : function ( event, ui ) {
$ ( this ).remove ( );
}
});
},
},
close : function ( event, ui ) {
$ ( this ).remove ( );
}
});
}
else {
alert ( 'Please install JQuery & JQuery UI & try again!' );
return;
}
}
if ( __m.GetAnimName ( __entity ) === 'death' ) {
__time.delayedCall ( 3000, function ( ) {
if ( __m.GetAnimName ( __entity ) === 'death' && __status === 2 ) {
__status = 0;
gameOverUI.__initializeWindow ({
status : __status,
scene : __scene,
camera : __camera,
entity : __entity,
time : __time,
});
}
}, [ __m.GetAnimName ( __entity, __debug ) ], this );
}
Any help as always is GREATLY appreciated!
Thank You! <3