Commits

Dominic Kexel committed beab0a1 Draft

added actor.py

  • Participants
  • Parent commits 41b06da

Comments (0)

Files changed (2)

+class Actor(object):
+  
+  def __init__(self, on_die=None, **kwargs):
+    self.scene = kwargs['scene']
+    self._on_die = on_die
+    self.z = 0
+    self.scene.create(self)
+    self._alpha = 255
+    
+  def die(self):
+    self.scene.destroy(self)
+    if self._on_die: self._on_die()
+
+  def update(self):
+    pass
+    
+  def draw(self, screen):
+    pass
+  
+  def _decrease_alpha(self, amount=1):
+    if self._alpha > 0: 
+      self._alpha -= amount
+      self._alpha = max(self._alpha, 0)
 from sound import *
 from resource import render_cached
 from art import get_art, build_surface
-
-
-
+from actor import Actor
 
 class GameState(object):
   
       self.time_to_go -= 1
     else:
       self.spawn = False
-    
-    
-class Actor(object):
-  
-  def __init__(self, on_die=None, **kwargs):
-    self.scene = kwargs['scene']
-    self._on_die = on_die
-    self.z = 0
-    self.scene.create(self)
-    self._alpha = 255
-    
-  def die(self):
-    self.scene.destroy(self)
-    if self._on_die: self._on_die()
-
-  def update(self):
-    pass
-    
-  def draw(self, screen):
-    pass
-  
-  def _decrease_alpha(self, amount=1):
-    if self._alpha > 0: 
-      self._alpha -= amount
-      self._alpha = max(self._alpha, 0)
 
 def draw_alpha_circle(screen, color, alpha, r, position):
     surface = pygame.surface.Surface((r*2, r*2), pygame.SRCALPHA, 32)
   def _on_hit(self):
     pass
   
-  
   @property
   def is_hit(self):
     return self._is_hit