r3-custom-code/f3jinliy1u.js

83 lines
1.6 KiB
JavaScript

if (this.parentEntity === data.entity) {
console.log('Entity Impact Snake');
} else {
return;
}
if (!this.initialized) {
/**
* Do some init stuff here
*/
this.initialized = true;
}
/**
* We override the system init so we get a handle on our canvas instance (instead of looking it up)
*/
ig.System.inject({
init : function(canvasId, fps, width, height, scale ) {
this.fps = fps;
this.clock = new ig.Timer();
this.canvas = R3.EntityManager.Instance.findComponentById('2km5mzakar').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('#noid', Snake, 60, 64 * 16, 64*16, 1 );
});
//@ sourceURL=entityLoaded.js