r3-custom-code/o7s7v9qq97.js

78 lines
1.6 KiB
JavaScript

if (this.parentEntity === data.entity) {
console.log('Entity Impact Test Loaded');
} else {
return;
}
if (!this.initialized) {
var texture = R3.EntityManager.Instance.findComponentById('77dqs286vu');
this.initialized = true;
}
ig.System.inject({
init : function( canvasId, fps, width, height, scale ) {
this.fps = fps;
this.clock = new ig.Timer();
this.canvas = R3.EntityManager.Instance.findComponentById('ov13qo2j1m').instance;
this.resize( width, height, scale );
this.context = this.canvas.getContext('2d');
this.getDrawPos = ig.System.drawMode;
// Automatically switch to crisp scaling when using a scale
// other than 1
if( this.scale != 1 ) {
ig.System.scaleMode = ig.System.SCALE.CRISP;
}
ig.System.scaleMode( this.canvas, this.context );
}
})
ig.module(
'game.impact-test'
)
.requires(
'impact.font',
'impact.game',
'impact.image',
'game.levels.snake'
)
.defines(function(){
// code for this module
// Create your own game class
ig.global.Snake = ig.Game.extend(
{
font: new ig.Font( 'media/04b03.font.png' ),
init: function() {
// initialize your game world, bind some
// keys, etc.
ig.input.bind( ig.KEY.SPACE, 'jump' );
console.log('init called');
this.loadLevel( LevelSnake );
},
draw : function() {
texture.instance.needsUpdate = true;
this.parent();
}
}
);
var size = R3.Utils.GetWindowSize();
// Start your game
// 60fps, 320x240 pixels, scaled up by a factor of 2
ig.main('#ov13qo2j1m', Snake, 60, 64 * 16, 64*16, 1 );
});
//@ sourceURL=entityLoaded.js