add level 12

This commit is contained in:
Juraj Michalek
2015-12-28 21:22:09 +01:00
parent 108954c461
commit 0d4fa91d18
7 changed files with 331 additions and 48 deletions

View File

@@ -37,4 +37,54 @@ function addTeleport(context, x, y, affectedX, affectedY, isForwardAnimation) {
function addTeleportPair(context, x, y, x2, y2) {
addTeleport(context, x, y, x2, y2, true);
addTeleport(context, x2, y2, x, y, false);
}
/**
* Add switch
*/
function addSwitch(context, x, y, cellIndex) {
var laserSwitch = new Kiwi.GameObjects.Sprite(context, context.textures.switch, x*64, y*64);
laserSwitch.cellIndex = cellIndex;
laserSwitch.initialCellIndex = cellIndex;
laserSwitch.type = 'switch';
context.redirectorGroup.addChild(laserSwitch);
return laserSwitch;
}
/**
* Add laser
*/
function addLaser(context, x, y, direction, isBurning) {
var laser = new Kiwi.GameObjects.Sprite(context, context.textures.laser, x*64, y*64);
if (direction == 'up') {
laser.animation.add('idle', [ 0, 4, 8, 4 ], 0.4, true);
laser.animation.add('burning', [ 0, 4, 8, 12, 16, 20, 24, 28, 32 ], 0.2, true);
} else {
laser.animation.add('idle', [ 2, 6, 10, 6 ], 0.4, true);
laser.animation.add('burning', [ 2, 6, 10, 14, 18, 22, 26, 30, 34 ], 0.2, true);
}
if (isBurning) {
laser.initialAnimation = 'burning';
} else {
laser.initialAnimation = 'idle';
}
laser.animation.play(laser.initialAnimation, true);
laser.type = 'laser';
context.redirectorGroup.addChild(laser);
return laser;
}
/**
* Add laser beam
*/
function addLaserBeam(context, x, y, cellIndex, isBurning) {
var laserBeam = new Kiwi.GameObjects.Sprite(context, context.textures.laserBeam, x*64, y*64);
laserBeam.cellIndex = cellIndex;
laserBeam.initialVisible = isBurning;
laserBeam.visible = isBurning;
laserBeam.type = 'laserBeam';
context.redirectorGroup.addChild(laserBeam);
return laserBeam;
}