simplify first level

This commit is contained in:
Juraj Michalek
2015-12-27 23:18:18 +01:00
parent 667f2edd61
commit 4116210d06
12 changed files with 156 additions and 77 deletions

View File

@@ -1,16 +1,13 @@
var level1 = {};
level1.create = function(context) {
// Define start coordinates
context.character.initialX = 4*64;
context.character.initialX = 2*64;
context.character.initialY = 2*64;
context.character.initialVelocityX = 64;
context.character.initialVelocityY = 0;
// Define finish coordinates
context.finishMarker.x = 2*64;
context.finishMarker.x = 7*64;
context.finishMarker.y = 2*64;
// Create redirector objects
addRedirector(context, 6, 1, -1, 0, 9);
}

View File

@@ -1,17 +1,16 @@
var level2 = {};
level2.create = function(context) {
// Create redirector objects
addRedirector(context, 6, 3, 1, 0, 0);
addRedirector(context, 4, 3, 0, 1, 6);
// Define player coordinates
context.character.x = 2*64 - 8;
context.character.y = 64 - 8;
context.character.physics.acceleration.x = 0;
context.character.physics.maxVelocity.y = 140;
// Define start coordinates
context.character.initialX = 4*64;
context.character.initialY = 2*64;
context.character.initialVelocityX = 64;
context.character.initialVelocityY = 0;
// Define finish coordinates
context.finishMarker.x = 6*64;
context.finishMarker.y = 4*64;
}
context.finishMarker.x = 2*64;
context.finishMarker.y = 2*64;
// Create redirector objects
addRedirector(context, 6, 1, -1, 0, 9);
}

View File

@@ -1,30 +1,17 @@
var level3 = {};
level3.create = function(context) {
// Define finish coordinates
context.finishMarker.x = 8*64;
context.finishMarker.y = 2*64;
// Add teleport
var teleport = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 4*64, 2*64);
teleport.animation.add('idle', [ 0, 1, 2, 3 ], 0.3, true);
teleport.animation.play('idle', true);
teleport.type = 'teleport';
teleport.affectedX = 9*64;
teleport.affectedY = 2*64;
context.redirectorGroup.addChild(teleport);
// Add target teleport marker
var teleportTarget = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 9*64, 2*64);
teleportTarget.animation.add('idle', [ 3, 2, 1, 0 ], 0.3, true);
teleportTarget.animation.play('idle', true);
teleportTarget.type = 'teleport';
teleportTarget.affectedX = 4*64;
teleportTarget.affectedY = 2*64;
context.redirectorGroup.addChild(teleportTarget);
// Create redirector objects
addRedirector(context, 9, 1, -1, 0, 9);
addRedirector(context, 9, 3, 1, 0, 0);
addRedirector(context, 10, 2, 0, -1, 3);
}
addRedirector(context, 6, 3, 1, 0, 0);
addRedirector(context, 4, 3, 0, 1, 6);
// Define player coordinates
context.character.x = 2*64 - 8;
context.character.y = 64 - 8;
context.character.physics.acceleration.x = 0;
context.character.physics.maxVelocity.y = 140;
// Define finish coordinates
context.finishMarker.x = 6*64;
context.finishMarker.y = 4*64;
}

View File

@@ -1,39 +1,27 @@
var level4 = {};
level4.create = function(context) {
// Define start coordinates
context.character.initialX = 1*64;
context.character.initialY = 1*64;
context.character.initialVelocityX = 64;
context.character.initialVelocityY = 0;
// Define finish coordinates
context.finishMarker.x = 9*64;
context.finishMarker.y = 4*64;
context.finishMarker.x = 8*64;
context.finishMarker.y = 2*64;
// Add teleport
var teleport = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 3*64, 3*64);
var teleport = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 4*64, 2*64);
teleport.animation.add('idle', [ 0, 1, 2, 3 ], 0.3, true);
teleport.animation.play('idle', true);
teleport.type = 'teleport';
teleport.affectedX = 10*64;
teleport.affectedY = 1*64;
teleport.affectedX = 9*64;
teleport.affectedY = 2*64;
context.redirectorGroup.addChild(teleport);
// Add target teleport marker
var teleportTarget = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 10*64, 1*64);
var teleportTarget = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 9*64, 2*64);
teleportTarget.animation.add('idle', [ 3, 2, 1, 0 ], 0.3, true);
teleportTarget.animation.play('idle', true);
teleportTarget.type = 'teleport';
teleportTarget.affectedX = 3*64;
teleportTarget.affectedY = 3*64;
teleportTarget.affectedX = 4*64;
teleportTarget.affectedY = 2*64;
context.redirectorGroup.addChild(teleportTarget);
// Add block
var box = new Kiwi.GameObjects.Sprite(context, context.textures.box, 4*64, 1*64);
box.type = 'box';
context.redirectorGroup.addChild(box);
// Create redirector objects
addRedirector(context, 9, 1, -1, 0, 9);
addRedirector(context, 9, 3, 1, 0, 0);

42
js/app/level-05.js Normal file
View File

@@ -0,0 +1,42 @@
var level5 = {};
level5.create = function(context) {
// Define start coordinates
context.character.initialX = 1*64;
context.character.initialY = 1*64;
context.character.initialVelocityX = 64;
context.character.initialVelocityY = 0;
// Define finish coordinates
context.finishMarker.x = 9*64;
context.finishMarker.y = 4*64;
// Add teleport
var teleport = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 3*64, 3*64);
teleport.animation.add('idle', [ 0, 1, 2, 3 ], 0.3, true);
teleport.animation.play('idle', true);
teleport.type = 'teleport';
teleport.affectedX = 10*64;
teleport.affectedY = 1*64;
context.redirectorGroup.addChild(teleport);
// Add target teleport marker
var teleportTarget = new Kiwi.GameObjects.Sprite(context, context.textures.teleport, 10*64, 1*64);
teleportTarget.animation.add('idle', [ 3, 2, 1, 0 ], 0.3, true);
teleportTarget.animation.play('idle', true);
teleportTarget.type = 'teleport';
teleportTarget.affectedX = 3*64;
teleportTarget.affectedY = 3*64;
context.redirectorGroup.addChild(teleportTarget);
// Add block
var box = new Kiwi.GameObjects.Sprite(context, context.textures.box, 4*64, 1*64);
box.type = 'box';
context.redirectorGroup.addChild(box);
// Create redirector objects
addRedirector(context, 9, 1, -1, 0, 9);
addRedirector(context, 9, 3, 1, 0, 0);
addRedirector(context, 10, 2, 0, -1, 3);
}

View File

@@ -6,8 +6,8 @@ levelSelectorState.preload = function() {
levelSelectorState.create = function() {
for (var i=1; i<levels.length+1; i++) {
var text = new Kiwi.GameObjects.Textfield( this, "Level " + i.toString(), 66+i*140, 60, "#000", 32, 'normal', 'Impact' );
var sprite = new Kiwi.GameObjects.Sprite(this, this.textures.button, 50+i*140, 50);
var text = new Kiwi.GameObjects.Textfield( this, "Level " + i.toString(), 16+(i-1)*140, 60, "#000", 32, 'normal', 'Impact' );
var sprite = new Kiwi.GameObjects.Sprite(this, this.textures.button, (i-1)*140, 50);
sprite.levelIndex = i;
sprite.input.onUp.add( this.buttonReleased, this );
this.addChild( sprite );