Skip to content

Commit

Permalink
Whoops, here's health bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Applegate committed Dec 1, 2012
1 parent 711bda3 commit afdd778
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions public/coffee/HealthBar.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
define ['jquery'], ($) ->

class HealthBar

healthHeight: 47
totalHealth: 6

constructor: (@canvas) ->
@bar = $('#health-bar')
@canvas.bind 'setHealth', @onSetHealth

onSetHealth: (e, data) =>
return unless data.health?
missing = @totalHealth - data.health
offset = missing * @healthHeight
@bar.css 'background-position', "0 #{offset}px"

return HealthBar
Binary file added public/img/health-bar-bg.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 public/img/health-bar-heart.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 public/img/health-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit afdd778

Please sign in to comment.