Skip to content

Commit

Permalink
new characters sprite, dead zombie animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Urbas committed Nov 30, 2013
1 parent 38f611d commit e0e25d3
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 58 deletions.
38 changes: 19 additions & 19 deletions app/data/characters.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@
"player": {
"sx": 0,
"sy": 0,
"cols": 2,
"cols": 6,
"tilew": 50,
"tileh": 100,
"frames": 6
},
"player_with_gun": {
"sx": 100,
"sy": 0,
"cols": 2,
"tilew": 50,
"tileh": 100,
"frames": 4
},
"zombie": {
"sx": 200,
"sy": 0,
"sx": 0,
"sy": 100,
"cols": 4,
"tilew": 50,
"tileh": 100,
"frames": 16
"frames": 4
},
"zombie_player": {
"sx": 300,
"sy": 0,
"cols": 1,
"sx": 0,
"sy": 200,
"cols": 6,
"tilew": 50,
"tileh": 100,
"frames": 4
"frames": 6
},
"human": {
"sx": 400,
"sy": 0,
"cols": 1,
"sx": 0,
"sy": 300,
"cols": 7,
"tilew": 50,
"tileh": 100,
"frames": 7
},
"zombie": {
"sx": 0,
"sy": 400,
"cols": 8,
"tilew": 50,
"tileh": 100,
"frames": 24
}
}
Binary file added app/images/bg-blured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/images/characters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/promo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/promo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 64 additions & 20 deletions app/scripts/game.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion app/scripts/game/init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ window.Game =
maxY: Game.map.p.h

trackEvent: (category, action, label, value) ->
unless value?
if !label?
ga 'send', 'event', category, action
else if !value?
ga 'send', 'event', category, action, label.toString()
# console.log('_gaq.push', category + ' | ', action + ' | ', label.toString())
else
Expand Down
31 changes: 31 additions & 0 deletions app/scripts/game/sprites/characters/dead_zombie.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Q = Game.Q

# animations object
Q.animations "deadZombie",
intro:
frames: [16, 17, 18, 19, 20, 21]
rate: 0.6
next: "stand"
stand:
frames: [21]
rate: 1

# human object and logic
Q.Sprite.extend "DeadZombie",
init: (p) ->
@_super p,
x: 0
y: 0
vx: 0
z: 18
sheet: "zombie"
sprite: "deadZombie"
type: Game.SPRITE_NONE
collisionMask: Game.SPRITE_TILES

@add "2d, animation"

# animations
@play "intro"


16 changes: 8 additions & 8 deletions app/scripts/game/sprites/characters/player.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@ Q = Game.Q
# animations object
Q.animations "player",
stand:
frames: [2]
frames: [1]
rate: 1
run:
frames: [0, 2, 4, 2]
frames: [0, 1, 2, 1]
rate: 1/4
hit:
frames: [3]
frames: [4]
loop: false
rate: 1
next: "stand"
jump:
frames: [1, 3, 5, 3]
frames: [3, 4, 5, 4]
rate: 1/3

Q.animations "playerWithGun",
stand:
frames: [2]
frames: [1]
rate: 1
run:
frames: [0, 2, 4, 2]
frames: [0, 1, 2, 1]
rate: 1/4
hit:
frames: [1]
frames: [3]
loop: false
rate: 1
next: "stand"
jump:
frames: [1]
frames: [3]
rate: 1

# player object and logic
Expand Down
13 changes: 6 additions & 7 deletions app/scripts/game/sprites/characters/zombie.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ Q = Game.Q

#
Q.animations "zombie",
stand:
frames: [4]
rate: 1
run:
frames: [0, 4, 8, 12]
frames: [0, 1, 2, 3]
rate: 0.4
hit:
frames: [13]
frames: [10]
loop: false
rate: 1
next: "run"
attack:
frames: [1, 5, 9, 13]
frames: [8, 9, 10, 11]
loop: false
rate: 1/2
next: "run"
fall:
frames: [3, 7, 11, 15, 15, 15, 15]
frames: [4, 5, 6, 7, 7, 7, 7]
rate: 1/5
loop: false
next: "run"
Expand Down Expand Up @@ -86,6 +83,8 @@ Q.Sprite.extend "Zombie",
if !@p.wasHuman && turnToHuman
# replace zombie with human
@stage.insert new Q.Human(x: @p.x, y: @p.y)
else
@stage.insert new Q.DeadZombie(x: @p.x, y: @p.y)

# update enemies counter
Q.state.dec "enemiesCounter", 1
10 changes: 7 additions & 3 deletions app/scripts/game/sprites/characters/zombie_player.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ Q = Game.Q
# animations object
Q.animations "zombiePlayer",
stand:
frames: [1]
frames: [4]
rate: 1
run:
frames: [0, 1, 2, 3]
frames: [3, 4, 5, 4]
rate: 1/3
jump:
frames: [0]
frames: [3]
rate: 1
intro:
frames: [0, 1, 2]
rate: 0.7
next: "stand"

# main object and logic
Q.Sprite.extend "ZombiePlayer",
Expand Down

0 comments on commit e0e25d3

Please sign in to comment.