simplify first level

This commit is contained in:
Juraj Michalek
2015-12-27 22:40:51 +01:00
parent d824f78071
commit 69a5fa0a4c
10 changed files with 250 additions and 66 deletions

View File

@@ -1,7 +1,7 @@
{ "height":6,
"layers":[
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 1, 1, 1, 24, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 2, 1, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"ground",
"opacity":1,
@@ -12,7 +12,7 @@
"y":0
},
{
"data":[0, 51, 51, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 21, 0, 0, 0, 0, 0, 22, 22, 22, 0, 0, 0, 0, 0, 0, 0, 21, 0, 51, 51, 51, 51, 51, 0, 52, 0, 32, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 0, 52, 0, 32, 0,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52, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 0, 42, 0, 22, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 41, 41, 41, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"data":[0, 51, 51, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 51, 51, 51, 51, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 51, 51, 51, 21, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 51, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"walls",
"opacity":1,

64
data/levels/level-03.json Normal file
View File

@@ -0,0 +1,64 @@
{ "height":6,
"layers":[
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 2, 1, 2, 0, 0, 4, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, 1, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"ground",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":18,
"x":0,
"y":0
},
{
"data":[0, 51, 51, 51, 51, 41, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 0, 22, 0, 32, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 52, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 0, 42, 0, 22, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 21, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 41, 41, 41, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"walls",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":18,
"x":0,
"y":0
},
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"sky",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":18,
"x":0,
"y":0
}],
"nextobjectid":4,
"orientation":"orthogonal",
"properties":
{
},
"renderorder":"right-down",
"tileheight":64,
"tilesets":[
{
"firstgid":1,
"image":"..\/images\/gfx64\/tiles.png",
"imageheight":448,
"imagewidth":640,
"margin":0,
"name":"base",
"properties":
{
},
"spacing":0,
"tilecount":70,
"tileheight":64,
"tilewidth":64
}],
"tilewidth":64,
"version":1,
"width":18
}

64
data/levels/level-04.json Normal file
View File

@@ -0,0 +1,64 @@
{ "height":6,
"layers":[
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 14, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"ground",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":18,
"x":0,
"y":0
},
{
"data":[0, 41, 41, 41, 41, 41, 41, 0, 41, 41, 41, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 41, 41, 41, 41, 0, 31, 31, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 31, 31, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 41, 0, 31, 0, 31, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"walls",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":18,
"x":0,
"y":0
},
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":6,
"name":"sky",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":18,
"x":0,
"y":0
}],
"nextobjectid":4,
"orientation":"orthogonal",
"properties":
{
},
"renderorder":"right-down",
"tileheight":64,
"tilesets":[
{
"firstgid":1,
"image":"..\/images\/gfx64\/tiles.png",
"imageheight":448,
"imagewidth":640,
"margin":0,
"name":"base",
"properties":
{
},
"spacing":0,
"tilecount":70,
"tileheight":64,
"tilewidth":64
}],
"tilewidth":64,
"version":1,
"width":18
}

View File

@@ -11,22 +11,27 @@
<script src="js/app/level-selector.js"></script>
<script src="js/app/level-01.js"></script>
<script src="js/app/level-02.js"></script>
<script src="js/app/level-03.js"></script>
<script src="js/app/level-04.js"></script>
</head>
<body>
<script>
var state = new Kiwi.State('state');
var levels = [level1, level2];
var levels = [level1, level2, level3, level4];
state.preload = function() {
this.addJSON('level1', 'data/levels/level-01.json');
this.addJSON('level2', 'data/levels/level-02.json');
this.addJSON('level3', 'data/levels/level-03.json');
this.addJSON('level4', 'data/levels/level-04.json');
this.addSpriteSheet('base', './data/images/gfx64/tiles.png', 64, 64);
this.addSpriteSheet('character', './data/images/gfx64/marble_black.png', 80, 80 );
this.addSpriteSheet('oneWay', './data/images/gfx64/st_oneway.png', 64, 64 );
this.addSpriteSheet('finishMarker', './data/images/gfx64/finish_marker.png', 64, 64 );
this.addSpriteSheet('button', './data/images/gfx64/button.png', 128, 64 );
this.addSpriteSheet('teleport', './data/images/gfx64/st_spitter_idle.png', 64, 64);
this.addSpriteSheet('box', './data/images/gfx64/st_box_wood.png', 64, 64);
}
state.velocityX = 64;
@@ -36,7 +41,11 @@ state.create = function() {
var level = levels[this.game.levelIndex - 1];
this.tilemap = new Kiwi.GameObjects.Tilemap.TileMap(this, 'level' + this.game.levelIndex.toString(), this.textures.base);
this.character = new Kiwi.GameObjects.Sprite(this, this.textures.character, 2*64 - 8, 64 - 8);
this.character = new Kiwi.GameObjects.Sprite(this, this.textures.character, 0, 0);
this.character.initialX = 2*64;
this.character.initialY = 64;
this.character.initialVelocityX = 0;
this.character.initialVelocityY = this.velocityY;
// Hitbox is detecting collision in future step.
// This is little bit counter intuitive.
// You have to make collision box smaller at least one step.
@@ -58,6 +67,9 @@ state.create = function() {
// Load level specific data
level.create(this);
// Fix character coordinates and speed
this.resetCharacter();
this.addChild(this.finishMarker);
@@ -109,8 +121,8 @@ state.buttonReleased = function(sprite) {
state.resetCharacter = function () {
this.character.physics.velocity.x = 0;
this.character.physics.velocity.y = 0;
this.character.x = 2*64 - 8;
this.character.y = 64 - 8;
this.character.x = this.character.initialX - 8;
this.character.y = this.character.initialY - 8;
}
state.startedDrag = function(sprite) {
@@ -166,7 +178,8 @@ state.stoppedDrag = function(sprite) {
}
state.activateScene = function () {
this.character.physics.velocity.y = this.velocityY;
this.character.physics.velocity.x = this.character.initialVelocityX;
this.character.physics.velocity.y = this.character.initialVelocityY;
this.stageState = 'running';
}
@@ -177,7 +190,6 @@ state.update = function () {
//Update physics
this.checkCollision();
this.updateCharacterMovement();
this.updateCharacterAnimation();
// this.resetCharacter();
@@ -244,20 +256,6 @@ state.checkCollision = function () {
}
state.updateCharacterMovement = function () {
//Move the player/character
if ( this.leftPressed ) {
this.character.scaleX = -1;
this.character.physics.velocity.x = -this.velocityX;
} else if ( this.rightPressed ) {
this.character.scaleX = 1;
this.character.physics.velocity.x = this.velocityY;
}
}
var game = new Kiwi.Game(null, 'PF 2016', levelSelectorState);
game.levelIndex = 0;
game.states.addState(state);

View File

@@ -1,17 +1,16 @@
var level1 = {};
level1.create = function(context) {
// Create redirector objects
addRedirector(context, 10, 2, 1, 0, 0);
addRedirector(context, 10, 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 level2 = {};
level2.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;
}

30
js/app/level-03.js Normal file
View File

@@ -0,0 +1,30 @@
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);
}

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

@@ -0,0 +1,42 @@
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;
// 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

@@ -5,7 +5,7 @@ levelSelectorState.preload = function() {
}
levelSelectorState.create = function() {
for (var i=1; i!=3; i++) {
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);
sprite.levelIndex = i;