tetris stuff
parent
4d7ac34a8a
commit
d90852e413
|
@ -84,6 +84,8 @@ GameLib.Event.PARENT_WORLD_CHANGE = 0x42;
|
||||||
GameLib.Event.ANIMATE = 0x43;
|
GameLib.Event.ANIMATE = 0x43;
|
||||||
GameLib.Event.ANIMATION_COMPILE_SUCCESS = 0x44;
|
GameLib.Event.ANIMATION_COMPILE_SUCCESS = 0x44;
|
||||||
GameLib.Event.ANIMATION_COMPILE_FAILED = 0x45;
|
GameLib.Event.ANIMATION_COMPILE_FAILED = 0x45;
|
||||||
|
GameLib.Event.CUSTOM_CODE_SYSTEM_STARTED = 0x46;
|
||||||
|
GameLib.Event.GAME_OVER = 0x47;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string name of event ID
|
* Returns string name of event ID
|
||||||
|
@ -163,6 +165,8 @@ GameLib.Event.GetEventName = function(number) {
|
||||||
case 0x43 : return 'animate';
|
case 0x43 : return 'animate';
|
||||||
case 0x44 : return 'animation_compile_success';
|
case 0x44 : return 'animation_compile_success';
|
||||||
case 0x45 : return 'animation_compile_failed';
|
case 0x45 : return 'animation_compile_failed';
|
||||||
|
case 0x46 : return 'custom_code_system_started';
|
||||||
|
case 0x47 : return 'game_over';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,10 +291,43 @@ GameLib.Component.prototype.clone = function() {
|
||||||
|
|
||||||
apiObject.id = GameLib.Utils.RandomId();
|
apiObject.id = GameLib.Utils.RandomId();
|
||||||
|
|
||||||
apiObject.name = apiObject.name + ' Clone (' + apiObject.id + ')';
|
apiObject.name = apiObject.name + ' (Clone)';
|
||||||
|
|
||||||
|
var runtimeObject = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
runtimeObject = new this.constructor(this.graphics, apiObject);
|
||||||
|
} catch (e){
|
||||||
|
console.log(e);
|
||||||
|
try {
|
||||||
|
runtimeObject = new this.constructor(this.physics, apiObject);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
try {
|
||||||
|
runtimeObject = new this.constructor(this.coder, apiObject);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
console.log('failed to construct a runtime component');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.COMPONENT_CREATED,
|
||||||
|
{
|
||||||
|
component : runtimeObject
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
runtimeObject.parentEntity = null;
|
||||||
|
|
||||||
|
// if (this.parentEntity instanceof GameLib.Entity) {
|
||||||
|
// this.parentEntity.addComponent(runtimeObject);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return runtimeObject;
|
||||||
|
|
||||||
//TODO - create runtime object - add to parent entity -
|
|
||||||
//var object = this.constructor.call(this, this.graphics, apiObject);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.Component.prototype.getStorageDependencies = function() {
|
GameLib.Component.prototype.getStorageDependencies = function() {
|
||||||
|
|
|
@ -114,7 +114,9 @@ GameLib.D3.CustomCode.prototype.launchEditor = function(){
|
||||||
value : this.code,
|
value : this.code,
|
||||||
mode : 'javascript',
|
mode : 'javascript',
|
||||||
lineNumbers : true,
|
lineNumbers : true,
|
||||||
scrollbarStyle : 'overlay'
|
scrollbarStyle : 'overlay',
|
||||||
|
indentWithTabs: true,
|
||||||
|
indentUnit : 4
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1171,4 +1171,4 @@ GameLib.D3.Mesh.prototype.computeBoundingBox = function(geometry) {
|
||||||
this.size.x = geometry.boundingBox.getSize().x;
|
this.size.x = geometry.boundingBox.getSize().x;
|
||||||
this.size.y = geometry.boundingBox.getSize().y;
|
this.size.y = geometry.boundingBox.getSize().y;
|
||||||
this.size.z = geometry.boundingBox.getSize().z;
|
this.size.z = geometry.boundingBox.getSize().z;
|
||||||
};
|
};
|
||||||
|
|
|
@ -146,15 +146,11 @@ GameLib.Matrix4.prototype.updateInstance = function() {
|
||||||
*/
|
*/
|
||||||
GameLib.Matrix4.prototype.toApiObject = function () {
|
GameLib.Matrix4.prototype.toApiObject = function () {
|
||||||
|
|
||||||
return this.rows.map(
|
return new GameLib.API.Matrix4(
|
||||||
function(row) {
|
this.rows[0].toApiObject(),
|
||||||
if (row instanceof GameLib.Vector4) {
|
this.rows[1].toApiObject(),
|
||||||
return row.toApiObject();
|
this.rows[2].toApiObject(),
|
||||||
} else {
|
this.rows[3].toApiObject()
|
||||||
console.warn('Incompatible conversion to API matrix for vector: ', row);
|
|
||||||
throw new Error('Incompatible conversion to API matrix for a vector');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,9 +46,9 @@ GameLib.System.Animation.prototype.start = function() {
|
||||||
intermediateAngle : mesh.quaternion.angle,
|
intermediateAngle : mesh.quaternion.angle,
|
||||||
subscription : null,
|
subscription : null,
|
||||||
inProcess : false,
|
inProcess : false,
|
||||||
blocking : animation.blocking,
|
blocking : animation.blocking//,
|
||||||
callbacks : [],
|
// callbacks : [],
|
||||||
storedValues : []
|
// storedValues : []
|
||||||
};
|
};
|
||||||
|
|
||||||
var getIntermediateAngle = function() {
|
var getIntermediateAngle = function() {
|
||||||
|
@ -57,9 +57,9 @@ GameLib.System.Animation.prototype.start = function() {
|
||||||
|
|
||||||
var getTargetAngle = function() {
|
var getTargetAngle = function() {
|
||||||
|
|
||||||
if (mesh.animationObject.storedValues.length > 0) {
|
// if (mesh.animationObject.storedValues.length > 0) {
|
||||||
return mesh.animationObject.storedValues[mesh.animationObject.storedValues.length - 1];
|
// return mesh.animationObject.storedValues[mesh.animationObject.storedValues.length - 1];
|
||||||
}
|
// }
|
||||||
|
|
||||||
return mesh.animationObject.targetAngle;
|
return mesh.animationObject.targetAngle;
|
||||||
};
|
};
|
||||||
|
@ -175,7 +175,7 @@ GameLib.System.Animation.prototype.start = function() {
|
||||||
// callback();
|
// callback();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
mesh.animationObject.storedValues = [];
|
// mesh.animationObject.storedValues = [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -201,8 +201,10 @@ GameLib.System.Animation.prototype.start = function() {
|
||||||
|
|
||||||
console.log('another animation is already in process');
|
console.log('another animation is already in process');
|
||||||
|
|
||||||
GameLib.Utils.PushUnique(mesh.animationObject.storedValues, value);
|
// setTargetAngle(value);
|
||||||
|
|
||||||
|
// GameLib.Utils.PushUnique(mesh.animationObject.storedValues, value);
|
||||||
|
//
|
||||||
// mesh.animationObject.callbacks.push(
|
// mesh.animationObject.callbacks.push(
|
||||||
// function(__value) {
|
// function(__value) {
|
||||||
// return function(){
|
// return function(){
|
||||||
|
|
|
@ -41,6 +41,14 @@ GameLib.System.CustomCode.prototype.start = function() {
|
||||||
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.CUSTOM_CODE_SYSTEM_STARTED,
|
||||||
|
{
|
||||||
|
system : this,
|
||||||
|
components : this.customCodeComponents
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue