Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change monk image, remove animation on focus

  • Loading branch information...
commit d3fc902b2be88100b9d533bd893d232240478df5 1 parent 33d88d7
Daniel Mark Schwartz authored
View
24 game.coffee
@@ -32,21 +32,14 @@ class Rainbow
bulletImage = new Image
bulletImage.src = 'bullet.png'
-shipImage0 = new Image
-shipImage0.src = 'monk_0.png'
-
-shipImage1 = new Image
-shipImage1.src = 'monk_1.png'
-
-shipImage2 = new Image
-shipImage2.src = 'monk_2.png'
-
enemyImage = new Image
enemyImage.src = 'enemy.gif'
#buddha1 = http://www.flickr.com/photos/27234114@N03/3200712567/sizes/o/
#title_monk = Photo credit: Christopher Chan / Foter / CC BY-NC-ND
+#monk = http://www.flickr.com/photos/pelegrino/3646823338/
imgs =
+ monk: 'monk.png'
buddha1: 'buddha1.png'
wheel: 'wheel.png'
eye: 'eye.png'
@@ -454,7 +447,7 @@ class Enemy
class Ship
- constructor: (@x, @y, @speed) ->
+ constructor: (@x, @y, @speed, @image = atom.images.monk) ->
@damage = 10
@r_max = 12
@@ -507,18 +500,11 @@ class Ship
@y += @speed * dt
draw: (ctx) ->
- if @o < .666
- image = shipImage2
- else if .666 <= @o < .833
- image = shipImage1
- else
- image = shipImage0
-
rand = randInRange -.1, .1
ctx.fillStyle = "rgba(0,0,200,#{1.5 - @o + rand})"
- ctx.fillRect @x - @r, 0, 2 * @r, @y - image.height/2
+ ctx.fillRect @x - @r, 0, 2 * @r, @y - @image.height/2
- ctx.drawImage image, @x - image.width/2, @y - image.height/2
+ ctx.drawImage @image, @x - @image.width/2, @y - @image.height/2
class BackgroundFlat
constructor: (@color) ->
View
BIN  monk.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  monk_0.png
Deleted file not rendered
View
BIN  monk_1.png
Deleted file not rendered
View
BIN  monk_2.png
Deleted file not rendered
Please sign in to comment.
Something went wrong with that request. Please try again.