Permalink
Browse files

Add more enemy animations, clean out temp imgs

  • Loading branch information...
1 parent cc4e9f6 commit b59c8f4121d0491c586c3590b211cc82e3d7e6ea Daniel Mark Schwartz committed Nov 30, 2012
Showing with 8 additions and 10 deletions.
  1. BIN eye_green.png
  2. +8 −10 game.coffee
  3. BIN head.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -40,13 +40,10 @@ class Rainbow
@h %= 360
[r,g,b] = hsv2rgb @h, s, v
-bulletImage = new Image
-bulletImage.src = 'bullet.png'
-
-enemyImage = new Image
-enemyImage.src = 'enemy.gif'
-
imgs =
+ bullet: 'bullet.png'
+ eyeGreen: 'eye_green.png'
+ head: 'head.png'
lotus: 'lotus.png'
monk: 'monk.png'
buddha1: 'buddha1.png'
@@ -361,13 +358,13 @@ moveRandom = (speed = 50, duration = [.2, 2], padx = [50,50], pady = [100, 250])
[x,y]
bulletStraight = (dx=0, dy=100) ->
- {image: bulletImage, move: moveStraight dx, dy}
+ {image: atom.images.bullet, move: moveStraight dx, dy}
bulletDirect = (s, e, speed = 100) ->
dx = s.ship?.x - e.x
dy = s.ship?.y - e.y
mag = speed / Math.sqrt(dx*dx + dy*dy)
- {image: bulletImage, move: moveStraight mag * dx, mag * dy}
+ {image: atom.images.bullet, move: moveStraight mag * dx, mag * dy}
fireEvery = (fireEvery=1) ->
t = 0
@@ -420,14 +417,14 @@ enemy =
theta = 2 * Math.PI * (i + .5*odd) / n
bulletStraight speed * Math.cos(theta), speed * Math.sin(theta)
)
- animate: new Animation enemyImage
+ animate: new AnimationRotate atom.images.head, .25
health: 1000
die: die.normal
direct: (dx, dy, g) ->
move: moveStraightGravity dx, dy, g
fire: fireEvery 1
bullet: [(dt, s, e) -> bulletDirect s, e]
- animate: new Animation enemyImage
+ animate: new Animation atom.images.eyeGreen
health: 1250
die: die.normal
@@ -609,6 +606,7 @@ class BackgroundCredits
'flickr.com/photos/27234114@N03/3200712567',
'flickr.com/photos/pelegrino/3646823338/',
'flickr.com/photos/rahuldb/3128100651/',
+ 'flickr.com/photos/wonderlane/6969928165/',
'',
'',
'Special Thanks:',
View
BIN head.png
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 b59c8f4

Please sign in to comment.