Commits

Anonymous committed 464fa13

BASICALLY DONE

  • Participants
  • Parent commits c5bc29f

Comments (0)

Files changed (3)

 import overlord
 import facebook
 
-MUSIC_FILENAME = "goof.wav"
+MUSIC_FILENAME = sys.argv[1]
 #MUSIC_FILENAME = "music/keep_on_rockin.wav"
 
 def cached_scientist(fn):
 overlord = Overlord(scientist, overlord.Difficulty.hard)
 
 # if any cmd flags, disable facebook connection
-facebook.init(len(sys.argv) > 1)
+facebook.init(len(sys.argv) > 2)
 
 
 PLAYER_SPIN_SPEED = 360.
 from morality import Evil # WE HAVE NO USE FOR GOODNESS HERE BWAHAHAHA
 import enemy
 import random
+import scipy.interpolate
+import math
 
 class Difficulty:
     easy, medium, hard, omgwtfbbq = range(4)
             #beats = [b for b in beats if b % self.every_x]
             #beats = [beats[0], beats[16], beats[32], beats[48]]
             t = (enemy.Type.large1, enemy.Type.large2, enemy.Type.medium1, 
-                    enemy.Type.medium2)
-            #return (t, lambda t: sin(time - t), time-t)
+                    enemy.Type.medium2, enemy.Type.small1, enemy.Type.small2)
             span = beats[-1] - time
+            #f = scipy.interpolate.interp1d(beats,  
+            #   [(math.sin(i * math.pi / 4.0) + 1)/2.0 for i in xrange(len(beats))], 
+            #   kind='quadratic')  
+            #def curve(number, ti):  
+            #    return f(ti).item() + .2 / number       
             #print span
-            def linear(x,ti):
-                #value = (number*1.0/wave_size, #+ number*1.0/(wave_size*2.0), 
-                value = (x, #+ number*1.0/(wave_size*2.0), 
+            def linear(number,ti):
+                print number
+                value = (number*1.0/wave_size, #+ number*1.0/(wave_size*2.0), 
+                #value = (x, #+ number*1.0/(wave_size*2.0), 
                                 1-(ti-time)/(span))
                 #print value
                 return value
             enemies = []
+            types = [t[i%len(t)] for i in range(wave_size)]
+            random.shuffle(types)
             for i in range(wave_size):
-                tpe = t[i%len(t)]
-                x = random.random() * 0.6 + 0.2
-                lam = lambda ti: linear(x,ti)
+                tpe = types[i]
+                #x = random.random() * 0.6 + 0.2
+                lam = (lambda num: lambda ti: linear(num,ti))(i)
+                #lam2 = (lambda num: lambda ti: curve(num,ti))(i)
+                #if tpe % 2==0:
                 enemies.append((tpe, lam))
+                #else:
+                #    enemies.append((tpe, lam2))
+            '''
+            f = scipy.interpolate.interp1d(beats,  
+            82   [(math.sin(i * math.pi / 4.0) + 1)/2.0 for i in xrange(len(beats))], kind='quadratic')  
+            83             def line 
+            102             def curve(number, ti):  
+            103                 return f(ti).item() + .2 / number       
+
+            '''
             return enemies
             #return [(t[i%len(t)], ) for i in range(wave_size)]
         return []
                 self._beats[time] = True
             time += 1
         print len(self._beats), self._beats[:100]
-    def next_beats(self, time, number=0, *a):
+    def next_beats(self, time, number=0, every_x=0):
         i = int(time  * SAMPLE_RATE)
         count = 0
         while count < number: