Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: louisremi/Slasher
base: 126a0aa579
...
head fork: louisremi/Slasher
compare: 3ae4166243
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
BIN  assets/sprites/teenagers.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  assets/sprites/traps.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 components/inventory.js
View
@@ -45,7 +45,7 @@ Crafty.c("Inventory", {
z:menuItem._z + 1
})
.saveOrigin()
- .attr({offset: data.offset, effect: data.effect});
+ .attr({offset: data.offset, effect: data.effect, name: key});
// ugly hack, means we're going fast
trap._element.style.opacity = 0;
@@ -66,30 +66,30 @@ Crafty.c("Inventory", {
});*/
Crafty.Inventory = {
- Pikes: {
+ Wolf: {
available: 3,
offsetY: 0,
- effect: "piked"
+ effect: "wolfed"
},
- Wolf: {
+ Acid: {
available: 3,
offsetY: 1,
- effect: "wolfed"
+ effect: "acided"
},
Trap: {
available: 3,
offsetY: 2,
effect: "trapped"
},
- Gaz: {
+ Pikes: {
available: 3,
offsetY: 3,
- effect: "gazzed"
+ effect: "piked"
},
- Acid: {
+ Gaz: {
available: 3,
offsetY: 4,
- effect: "acided"
+ effect: "gazzed"
}
};
26 components/teenager.js
View
@@ -3,15 +3,29 @@
Crafty.c("Teenager",{
movePath:[],
dead:false,
+ speed: 1,
init: function() {
this.requires('2D, DOM, Move, TilePos, Tween, Delay, Afraidable, SpriteAnimation')
.bind("piked", function() {
- this.switchSprite("Piked");
+ this.switchSprite( this.name + "Piked");
this.die( true );
})
.bind("wolfed", function() {
- this.switchSprite("Wolfed");
+ this.switchSprite( this.name + "Wolfed");
+ this.die( true );
+ })
+ .bind("trapped", function() {
+ this.switchSprite( "Trapped");
+ this.die( true );
+ })
+ .bind("gazzed", function() {
+ this.switchSprite( this.name + "Gazzed");
+ this.speed = .5;
+ //this.die( true );
+ })
+ .bind("acided", function() {
+ this.switchSprite("Acided");
this.die( true );
})
.bind('teenMoved',function() {
@@ -40,9 +54,9 @@
});
},
- switchSprite: function( state ) {
+ switchSprite: function( state ) {console.log("Switch" + state)
this.removeComponent( this.name );
- this.addComponent( this.name + state + "Sprite" );
+ this.addComponent( state + "Sprite" );
return this;
},
@@ -144,7 +158,7 @@
var dest = this.movePath[0];
- this.tween({x:dest._x-16,y:dest._y-32},30);
+ this.tween({x:dest._x-16,y:dest._y-32},30 / this.speed);
/*if (dest._x < this._x)
this.move('w',Crafty.tileSize);
@@ -159,7 +173,7 @@
this.trigger('teenMoved');
- this.delay(this.initiateMovement,700);
+ this.delay(this.initiateMovement,700 / this.speed);
} else {
this.tilePos();
this.isMoving = false;
13 components/teenagers.js
View
@@ -5,10 +5,10 @@ Crafty.c("Teenagers", {
$.each( Crafty.Teenagers, function( key, data ) {
var sprites = {};
sprites[ key + "Sprite" ] = [ 0, data.offsetY ];
- sprites[ key + "SmokedSprite" ] = [ 1, data.offsetY ];
- sprites[ key + "PikedSprite" ] = [ 2, data.offsetY ];
- sprites[ key + "TrappedSprite" ] = [ 3, data.offsetY ];
- sprites[ key + "DeadSprite" ] = [ 4, data.offsetY ];
+ sprites[ key + "GazzedSprite" ] = [ 1, data.offsetY ];
+ sprites[ key + "PikedSprite" ] = [ 6, data.offsetY ];
+ sprites[ key + "WolfedSprite" ] = [ 2, data.offsetY ];
+ sprites[ key + "DeadSprite" ] = [ 5, data.offsetY ];
Crafty.sprite(104, "assets/sprites/teenagers.png", sprites );
@@ -26,7 +26,10 @@ Crafty.c("Teenagers", {
// Don't forget the corroded sprite
Crafty.sprite(104, "assets/sprites/teenagers.png", {
- CorrodedSprite: [0,6]
+ AcidedSprite: [0,5]
+ });
+ Crafty.sprite(64, "assets/sprites/traps.png", {
+ TrappedSprite: [1,2]
});
}
});
7 components/trap.js
View
@@ -12,7 +12,7 @@
this.bind("trigger", function( teenager ) {
if ( this.preventTrigger ) { return; }
- this.unbind("trigger");
+ //this.unbind("trigger");
// play animation
/*this.requires("SpriteAnimation")
@@ -24,7 +24,10 @@
});*/
teenager.trigger( this.effect || "die" );
- this.destroy();
+
+ //if ( this.name != "Trap" ) {
+ this.destroy();
+ //}
});

No commit comments for this range

Something went wrong with that request. Please try again.