Skip to content
Browse files

Fork skill created

  • Loading branch information...
1 parent 49ced01 commit 11629f737b05db95ea54c4d432fcb1f0af9023d2 @hugeen committed
View
3 assets/css/defend_the_den.css
@@ -1,5 +1,4 @@
-@import url(http://fonts.googleapis.com/css?family=Finger+Paint|Marcellus+SC|Underdog|Sofadi+One);
-
+@import url(http://fonts.googleapis.com/css?family=Finger+Paint|Audiowide|Press+Start+2P|Marcellus+SC|Underdog|Sofadi+One);
html, body {
width: 100%;
height: 100%;
View
BIN assets/images/skills.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/sprites/fork.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN assets/sprites/granny.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
16 game/assets.js
@@ -31,17 +31,21 @@ define(function() {
scenes: ["level"]
}, {
type: "sprites",
+ name: "fork",
+ size: 34,
+ scenes: ["level"],
+ maps: [{
+ name: "fork",
+ coords: { x: 0, y: 0, w: 3, h: 1 }
+ }]
+ }, {
+ type: "sprites",
name: "wires",
size: 42,
scenes: ["level"],
maps: [{
name: "wires",
- coords: {
- x: 0,
- y: 0,
- w: 1,
- h: 10
- }
+ coords: { x: 0, y: 0, w: 1, h: 10 }
}]
}];
View
1 game/components.js
@@ -10,6 +10,7 @@ define([
'game/components/characters/playable_character',
'game/components/characters/wolf',
'game/components/cooldown',
+ 'game/components/damages',
'game/components/effects/blood',
'game/components/effects/git',
'game/components/image_particles',
View
4 game/components/bullet.js
@@ -23,6 +23,10 @@ define([
x: Math.cos(radian) * speed,
y: Math.sin(radian) * speed
};
+
+ this.origin("center");
+ this.rotation = Crafty.math.radToDeg(radian);
+
this.attr(startCoords);
this.bind("EnterFrame", function() {
View
6 game/components/characters/octocat.js
@@ -25,8 +25,12 @@ define([
this.onHit("Bullet", function(others) {
others[0].obj.destroy();
- this.takeDamages(50);
+
+ var damages = Math.round(Crafty.math.randomNumber(30,70));
+
+ this.takeDamages(damages);
this.git({x: 35, y: 45});
+ Crafty.e("Damages").display(damages, { x: this._x, y: this._y });
});
this.bind("Death", function() {
View
25 game/components/damages.js
@@ -0,0 +1,25 @@
+define([
+ 'crafty'
+], function(Crafty) {
+
+ Crafty.c("Damages", {
+ init: function() {
+ this.addComponent("2D, Canvas, Text, Delay");
+ this.textColor('#FFFFFF', 0.8);
+ this.displayed = false;
+ this.textFont({ type: 'italic', family: "'Marcellus SC', serif", size: '20px' });
+ },
+ display: function(damages, position) {
+ this.displayed = true
+ this.attr({
+ x: position.x+20,
+ y: position.y
+ });
+ this.text(damages);
+ this.delay(function() {
+ this.destroy();
+ }, 250);
+ }
+ });
+
+});
View
10 game/components/skills/attack.js
@@ -4,14 +4,12 @@ define([
Crafty.c("Attack", {
init : function() {
- this.addComponent("Bullet, axe, Collision");
+ this.addComponent("Bullet, fork, Collision");
this.speed = 15;
-
+
+ this.collision(new Crafty.polygon([8,14],[67,14],[67,5],[91,5],[91,24],[67,24],[67,20],[8,20]));
+
this.attack = function(from, to) {
- this.origin("center");
- this.bind("EnterFrame", function() {
- this.rotation += 15;
- });
this.fire(from, to, this.speed);
};
View
4 game/scenes/level.js
@@ -26,8 +26,8 @@ define([
$("#skills").append(compiledTemplate);
});
- //var monster = MonsterEntity.create("Octocat", 1);
- //var monster = MonsterEntity.create("Octocat", 3);
+ var monster = MonsterEntity.create("Octocat", 1);
+ var monster = MonsterEntity.create("Octocat", 3);
Crafty.e("Wires");
$("body").on("click", "#wrapper", function() {
View
2 game/skills.js
@@ -22,7 +22,7 @@ define([
y: player.y+25
}, mousePosition());
},
- backgroundPosition: "-53px 0"
+ backgroundPosition: "-424px 0"
}, {
cooldown: 5,
name: "Blow",

0 comments on commit 11629f7

Please sign in to comment.
Something went wrong with that request. Please try again.