home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 124 / cd-rom 124.iso / edu / tuxmath / tuxmathscrabble / asymptopia / Spot.py < prev    next >
Encoding:
Python Source  |  2003-11-09  |  2.2 KB  |  88 lines

  1. """
  2. /***************************************************************************
  3.  
  4.     Author             :Charles B. Cosse 
  5.     
  6.     Email            :ccosse@asymptopia.com
  7.                     
  8.                     
  9.     Copyright        :(C) 2002,2003 Asymptopia Software.
  10.     
  11.  ***************************************************************************/
  12. /***************************************************************************
  13.                           Spot.py
  14.  
  15.  ***************************************************************************/
  16.  
  17. /***************************************************************************
  18.  *                                                                         *
  19.  *   This program is free software; you can redistribute it and/or modify  *
  20.  *   it under the terms of the GNU General Public License as published by  *
  21.  *   the Free Software Foundation; either version 2 of the License, or     *
  22.  *   (at your option) any later version. (Please note that if you use this *
  23.  *   code you must give credit by including the Author and Copyright       *
  24.  *   info at the top of this file).                                        *
  25.  ***************************************************************************/
  26. """
  27. import pygame
  28. from pygame.locals import *
  29. from myutil import *
  30.  
  31. class Spot(pygame.sprite.Sprite):
  32.     def __init__(self,default_image,M,N,TYPE):
  33.         pygame.sprite.Sprite.__init__(self)
  34.         if default_image:
  35.             self.default_image,self.rect=load_image(default_image,-1)
  36.             self.image=self.default_image
  37.         else:
  38.             self.default_image=None
  39.             self.rect=pygame.Rect(0,0,0,0)
  40.             self.image=None
  41.         self.guest=None
  42.         self.locked=0
  43.         self.M=M
  44.         self.N=N
  45.         self.TYPE=TYPE
  46.         
  47.         
  48.         self.AMHEAD=0
  49.         self.AMROWEXPR=0
  50.         self.AMCOLEXPR=0
  51.         self.ROWEXPRLENGTH=0
  52.         self.COLEXPRLENGTH=0
  53.  
  54.     
  55.     def setMN(self,M,N):
  56.         self.M=M
  57.         self.N=N
  58.     
  59.     def getMN(self):
  60.         return((self.M,self.N))
  61.         
  62.     def take_guest(self,guest,use_guest_image):
  63.         self.guest=guest
  64.         #print 'guest=',guest
  65.         self.guest.rect.center=self.rect.center
  66.         if use_guest_image:self.image=guest.image
  67.  
  68.     def lock(self):
  69.         self.locked=1
  70.     
  71.     def islocked(self):
  72.         return(self.locked)
  73.  
  74.     def occupied(self):
  75.         if self.guest==None:return(0)
  76.         return(1)
  77.         
  78.     def pop_guest(self):
  79.         self.image=self.default_image
  80.         guest=self.guest
  81.         self.guest=None
  82.         return(guest)
  83.         
  84.     def update(self):
  85.         pass
  86.         
  87.     
  88.