push
This commit is contained in:
parent
5a20a0f8be
commit
5ac1cab9cc
BIN
docs/assets/images/epic.png
Normal file
BIN
docs/assets/images/epic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.3 KiB |
@ -50,15 +50,16 @@ var constants = {
|
|||||||
leg_speed: 0.1,
|
leg_speed: 0.1,
|
||||||
movement_divider: 50,
|
movement_divider: 50,
|
||||||
max_movement_speed: 3,
|
max_movement_speed: 3,
|
||||||
width: 30,
|
width: 40,
|
||||||
height: 50,
|
height: 75,
|
||||||
select_range: 10,
|
select_range: 10,
|
||||||
|
leg_length: 75,
|
||||||
hip: {
|
hip: {
|
||||||
offset_x: 15,
|
offset_x: 20,
|
||||||
offset_y: 25
|
offset_y: 35
|
||||||
},
|
},
|
||||||
defaultX: 500,
|
defaultX: 500,
|
||||||
defaultY: -70
|
defaultY: -170
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
@ -5,7 +5,7 @@ page_preloader.show(true);
|
|||||||
images = [
|
images = [
|
||||||
"assets/images/",
|
"assets/images/",
|
||||||
"level.png",
|
"level.png",
|
||||||
"level_2.png",
|
"epic.png",
|
||||||
"heartCover.png",
|
"heartCover.png",
|
||||||
"heartBack.png",
|
"heartBack.png",
|
||||||
"blinkOverlay.png",
|
"blinkOverlay.png",
|
||||||
@ -80,8 +80,8 @@ function draw() {
|
|||||||
if(!justBlinked) {
|
if(!justBlinked) {
|
||||||
|
|
||||||
camera.zoom = 1;
|
camera.zoom = 1;
|
||||||
|
imgIgnoreCutoff(sprites.epic,0,0);
|
||||||
drawWorldBlocks();
|
drawWorldBlocks();
|
||||||
imgIgnoreCutoff(sprites.level_2,0,0,0,4,4);
|
|
||||||
player.draw();
|
player.draw();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -99,7 +99,7 @@ function draw() {
|
|||||||
break;
|
break;
|
||||||
//building - to be used only in development
|
//building - to be used only in development
|
||||||
case globalStates.building:
|
case globalStates.building:
|
||||||
|
imgIgnoreCutoff(sprites.epic,0,0);
|
||||||
buildDraw();
|
buildDraw();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ class Player {
|
|||||||
this.h = constants.player.height;
|
this.h = constants.player.height;
|
||||||
this.hipLeft = { x: this.x + constants.player.hip.offset_x, y: this.y + constants.player.hip.offset_y };
|
this.hipLeft = { x: this.x + constants.player.hip.offset_x, y: this.y + constants.player.hip.offset_y };
|
||||||
this.hipRight = { x: this.x - constants.player.hip.offset_x, y: this.y + constants.player.hip.offset_y };
|
this.hipRight = { x: this.x - constants.player.hip.offset_x, y: this.y + constants.player.hip.offset_y };
|
||||||
this.leftLeg = new Leg(this.hipLeft.x, this.hipLeft.y, 50, Math.PI*2.5);
|
this.leftLeg = new Leg(this.hipLeft.x, this.hipLeft.y, constants.player.leg_length, Math.PI*2.5);
|
||||||
this.rightLeg = new Leg(this.hipRight.x, this.hipRight.y, 50, Math.PI*2.5);
|
this.rightLeg = new Leg(this.hipRight.x, this.hipRight.y, constants.player.leg_length, Math.PI*2.5);
|
||||||
this.legSelected = "R";
|
this.legSelected = "R";
|
||||||
this.shouldMoveLeg = false;
|
this.shouldMoveLeg = false;
|
||||||
this.collided = false;
|
this.collided = false;
|
||||||
@ -76,7 +76,34 @@ Player.prototype.update = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// god mode
|
||||||
|
// if(keyDown[k.w]) {
|
||||||
|
// this.y-=5;
|
||||||
|
// }
|
||||||
|
// if(keyDown[k.s]) {
|
||||||
|
// this.y+=5;
|
||||||
|
// }
|
||||||
|
// if(keyDown[k.a]) {
|
||||||
|
// this.x-=5;
|
||||||
|
// }
|
||||||
|
// if(keyDown[k.d]) {
|
||||||
|
// this.x+=5;
|
||||||
|
// }
|
||||||
|
|
||||||
centerCameraOn(this.x,this.y);
|
centerCameraOn(this.x,this.y);
|
||||||
|
// camera limits
|
||||||
|
if(camera.x > 898) {
|
||||||
|
camera.x = 898;
|
||||||
|
}
|
||||||
|
if(camera.x < -98) {
|
||||||
|
camera.x = -98;
|
||||||
|
}
|
||||||
|
if(camera.y < 245) {
|
||||||
|
camera.y = 245;
|
||||||
|
}
|
||||||
|
if(camera.y > 350) {
|
||||||
|
camera.y = 350;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ function drawLevelTransitionUI() {
|
|||||||
|
|
||||||
// draws background sprites
|
// draws background sprites
|
||||||
drawWorldBlocks();
|
drawWorldBlocks();
|
||||||
imgIgnoreCutoff(sprites.level_2,0,0,0,4,4);
|
imgIgnoreCutoff(sprites.epic,0,0);
|
||||||
player.draw();
|
player.draw();
|
||||||
|
|
||||||
// sets alpha to calculated alpha for black
|
// sets alpha to calculated alpha for black
|
||||||
|
@ -12,7 +12,7 @@ class block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create blocks
|
// create blocks
|
||||||
var blockData = [942,-184,94,507,942,191,94,507,372,411,1054,67,-316,369,1214,152,-38,270,86,107,-166,243,125,127,238,320,45,127,273,284,45,127,309,248,45,127,341,215,45,127,377,179,45,127,412,143,45,127,450,107,45,127,603,105,285,196,777,27,285,196,-989,23,175,959,154,-441,2555,51];
|
var blockData = [705,-8,491,64,460,27,74,64,425,64,74,64,389,99,74,64,352,135,74,64,321,167,74,64,285,203,74,64,249,239,74,64,-18,299,3314,111,-43,205,59,90,-44,207,80,63,-168,199,128,108,-168,144,158,25,-978,-101,158,984,14,-398,1958,85,928,-192,58,345,664,-101,25,133,867,-102,25,133,765,-97,185,67];
|
||||||
for (let i = 0, l = blockData.length; i < l; i += 4) {
|
for (let i = 0, l = blockData.length; i < l; i += 4) {
|
||||||
collisionRects.push(new block(blockData[i], blockData[i + 1], blockData[i + 2], blockData[i + 3]));
|
collisionRects.push(new block(blockData[i], blockData[i + 1], blockData[i + 2], blockData[i + 3]));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user