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;
}

View File

@@ -147,7 +147,6 @@ level7.create = function(context) {
box2.initialX = 9*64;
box2.initialY = 3*64;
context.redirectorGroup.addChild(box2);
};
var level8 = {};
@@ -162,35 +161,11 @@ level8.create = function(context) {
context.finishMarker.x = 11*64;
context.finishMarker.y = 4*64;
// Laser
var laser = new Kiwi.GameObjects.Sprite(context, context.textures.laser, 4*64, 1*64);
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);
laser.animation.play('burning', true);
laser.initialAnimation = 'burning';
laser.type = 'laser';
context.redirectorGroup.addChild(laser);
var laser2 = new Kiwi.GameObjects.Sprite(context, context.textures.laser, 4*64, 3*64);
laser2.animation.add('idle', [ 0, 4, 8, 4 ], 0.4, true);
laser2.animation.add('burning', [ 0, 4, 8, 12, 16, 20, 24, 28, 32 ], 0.2, true);
laser2.animation.play('burning', true);
laser2.initialAnimation = 'burning';
laser2.type = 'laser';
context.redirectorGroup.addChild(laser2);
var laserBeam = new Kiwi.GameObjects.Sprite(context, context.textures.laserBeam, 4*64, 2*64);
laserBeam.cellIndex = 1;
laserBeam.initialVisible = true;
laserBeam.type = 'laserBeam';
context.redirectorGroup.addChild(laserBeam);
var laserSwitch = new Kiwi.GameObjects.Sprite(context, context.textures.switch, 2*64, 3*64);
laserSwitch.cellIndex = 0;
laserSwitch.initialCellIndex = 0;
laserSwitch.type = 'switch';
context.redirectorGroup.addChild(laserSwitch);
var laser = addLaser(context, 4, 1, 'down', true);
var laser2 = addLaser(context, 4, 3, 'up', true);
var laserBeam = addLaserBeam(context, 4, 2, 1, true);
var laserSwitch = addSwitch(context, 2, 3, 0);
// Laser
var laser3 = new Kiwi.GameObjects.Sprite(context, context.textures.laser, 8*64, 2*64);
@@ -209,23 +184,11 @@ level8.create = function(context) {
laser4.type = 'laser';
context.redirectorGroup.addChild(laser4);
var laserBeam2 = new Kiwi.GameObjects.Sprite(context, context.textures.laserBeam, 8*64, 3*64);
laserBeam2.cellIndex = 1;
laserBeam2.initialVisible=true;
laserBeam2.type = 'laserBeam';
context.redirectorGroup.addChild(laserBeam2);
var laserSwitch2 = new Kiwi.GameObjects.Sprite(context, context.textures.switch, 6*64, 3*64);
laserSwitch2.cellIndex = 0;
laserSwitch2.initialCellIndex = 0;
laserSwitch2.type = 'switch';
var laserBeam2 = addLaserBeam(context, 8, 3, 1, true);
var laserSwitch2 = addSwitch(context, 6, 3, 0);
laserSwitch2.linkedItems = [laser3, laser4, laserBeam2];
context.redirectorGroup.addChild(laserSwitch2);
var laserSwitch3 = new Kiwi.GameObjects.Sprite(context, context.textures.switch, 5*64, 3*64);
laserSwitch3.cellIndex = 0;
laserSwitch3.initialCellIndex = 0;
laserSwitch3.type = 'switch';
var laserSwitch3 = addSwitch(context, 5, 3, 0);
laserSwitch3.linkedItems = [laser, laser2, laserBeam, laserSwitch];
context.redirectorGroup.addChild(laserSwitch3);
@@ -248,8 +211,6 @@ level8.create = function(context) {
// Up
addRedirector(context, 10, 2, 0, -1, 3);
addRedirector(context, 9, 2, 0, -1, 3);
};
var level9 = {};
@@ -321,4 +282,80 @@ level10.create = function(context) {
addRedirector(context, 8, 2, 0, 1, 6);
addRedirector(context, 8, 3, 0, 1, 6);
addRedirector(context, 8, 4, 0, 1, 6);
};
};
var level11 = {};
level11.create = function(context) {
// Define start coordinates
context.character.initialX = 4*64;
context.character.initialY = 4*64;
context.character.initialVelocityX = 64;
context.character.initialVelocityY = 0;
// Define finish coordinates
context.finishMarker.x = 9*64;
context.finishMarker.y = 1*64;
};
var level12 = {};
level12.create = function(context) {
// Define start coordinates
context.character.initialX = 0*64;
context.character.initialY = 5*64;
context.character.initialVelocityX = 16;
context.character.initialVelocityY = 0;
// Define finish coordinates
context.finishMarker.x = 12*64;
context.finishMarker.y = 5*64;
var laser = addLaser(context, 1, 4, 'up', false);
var laserSwitch = addSwitch(context, 1, 5, 2);
laserSwitch.linkedItems = [laser,
addLaserBeam(context, 1, 3, 1, false),
addLaserBeam(context, 1, 2, 2, false),
addLaserBeam(context, 1, 1, 1, false),
addLaserBeam(context, 1, 0, 3, false),
addLaserBeam(context, 2, 0, 4, false),
addLaserBeam(context, 2, 1, 1, false),
addLaserBeam(context, 2, 2, 5, false),
];
var laser2 = addLaser(context, 4, 4, 'up', false);
var laserSwitch2 = addSwitch(context, 4, 5, 2);
laserSwitch2.linkedItems = [laser2,
addLaserBeam(context, 4, 3, 1, false),
addLaserBeam(context, 4, 2, 2, false),
addLaserBeam(context, 4, 1, 1, false),
addLaserBeam(context, 4, 0, 3, false),
addLaserBeam(context, 5, 0, 0, false),
addLaserBeam(context, 5, 2, 0, false),
addLaserBeam(context, 6, 0, 1, false),
];
var laser3 = addLaser(context, 8, 4, 'up', false);
var laserSwitch3 = addSwitch(context, 8, 5, 2);
laserSwitch3.linkedItems = [laser3,
addLaserBeam(context, 8, 3, 1, false),
addLaserBeam(context, 8, 2, 1, false),
addLaserBeam(context, 8, 1, 6, false),
addLaserBeam(context, 8, 0, 1, false),
addLaserBeam(context, 7, 1, 0, false),
];
var laser4 = addLaser(context, 10, 4, 'up', false);
var laserSwitch4 = addSwitch(context, 10, 5, 2);
laserSwitch4.linkedItems = [laser4,
addLaserBeam(context, 10, 3, 1, false),
addLaserBeam(context, 10, 2, 2, false),
addLaserBeam(context, 10, 1, 1, false),
addLaserBeam(context, 10, 0, 3, false),
addLaserBeam(context, 11, 0, 0, false),
addLaserBeam(context, 11, 2, 0, false),
addLaserBeam(context, 11, 4, 0, false),
addLaserBeam(context, 12, 2, 4, false),
addLaserBeam(context, 12, 3, 1, false),
addLaserBeam(context, 12, 4, 5, false),
];
};