Example #1
0
  def __init__( self, assetpath ):
    """
      Initialize the Effect with the art assets located at assetpath

      INPUT:
        assetpath: the full path to the directory containing the images to use
      
      image file names should be sortable in the order they are to be played
    """
    #TODO: hardcoded asset paths
    self._gfxeffects={'null' : None,
                      'slash': { 'assetpath' :"/home/lorin/projects/ge/art/cut_a",
                                 'framepaths': [] }
                     }
    framenames = os.listdir( assetpath ) #retrieve the names of all files in the dir
    framenames.sort()
    framepaths = []
    for frame in framenames:
      framepaths.append( str( os.path.join( assetpath, frame )) )#generate the full path to the asset

    #TODO: BAAAAH, MESSY, model should be somewhere else, like file or db
    _model = Vertel()
    _model.set( [ ( 0.0, 0.0, 0.0 ), 
                  ( 0.0, 100.0/600.0, 0.0 ), 
                  ( 100.0/800.0, 100.0/600.0,0.0 ),
                  ( 100.0/800.0 , 0.0, 0.0 ) ] )
    super( Effect, self ).__init__( framepaths, _model )
    self.alive = True


    #init triggers
    self._triggers = {} #currently 1 callback per frame, multiple triggers doable with multidict
Example #2
0
  def __init__(self,name,imagefile,context,skills=[],factionid=0):
    """
    """
    model = [ (0,0), (0,181), (100,181), (100,0) ]
    bounding_rect = [ (0,0), (0,181), (100,181), (100,0) ]
    #super( Character, self ).__init__( model, imagefile, offset=(0,50) )
    _model = Vertel()
    _model.set( [ ( 0.0, 0.0, 0.0 ), 
                    ( 0.0, 171.0/600.0, 0.0 ), 
                    ( 101.0/800.0, 171.0/600.0,0.0 ),
                    ( 101.0/800.0 , 0.0, 0.0 ) ] )
    _bound = Vertel()
    _bound.set( [ ( 0.0, 0.0, 0.0 ),
                    ( 0.0, 100.0/600, 0.0 ),
                    ( 100.0/800.0, 100.0/600, 0.0 ),
                    ( 100.0/800, 0.0, 0.0 ) ] )
    super( Character, self ).__init__( imagefile, _model, _bound )
    #self.name = kwargs.get('name',"Unnamed")
    self.name = name
    self.mind = Mind( ego=self, factionid=factionid ) 

    self._controller = None

    self._context = context

    self._target = None

    #body stats
    self.strength  =  10  #strength of character, in kg*m*s^-2
    self.agility   =  20  #agility of character,  in kg*m*s^-2
    self.endurance =  10  #endurance: MAX Energy Reserves, in 
                          #endurance 
                          #endurance: MAX energy output in watts in kg*m^2*s^-3
    self._reach = 1.0     #arm length
    self._mass   = 50   #mass of character, in kg
    self.health = 100  #

    self.energy = Energy()

    self._alive  = True #alive bit, used to drop a character object references

    #skills
    self.skillbook  = SkillBook(skills=skills) 
    self.deck       = Deck(maxsize=4, slots=['default']*6 )

    #equipment
    self._equipment = Equipment()     #equipment is currently held by the character
    self.inventory = Inventory(40.0) #items in storage
    self.weapon = None

    #modifiers
    self.buff = Buffable(self) #allows the character to be buffed (stat and status effects)
    self.status_effects = []
    self._wounds = []
Example #3
0
  def __init__( self, **kwargs ):
    """
      volume - the volume this object occupies
    """

#    super( Gitem, self ).__init__(kwargs.get('model',Gitem.default_model),
#                                  kwargs.get('texture',None),
#                                  kwargs.get('drawmode','polygon'),
#                                  kwargs.get('offset',(0,0) )
    self.texture = kwargs.get('texture',None)
    if self.texture:
      _model = Vertel()
      _model.set( [ ( 0.0, 0.0, 0.0 ), 
                    ( 0.0, 171.0/600.0, 0.0 ), 
                    ( 101.0/800.0, 171.0/600.0,0.0 ),
                    ( 101.0/800.0 , 0.0, 0.0 ) ] )
      _bound = Vertel()
      _bound.set( [ ( 0.0, 0.0, 0.0 ),
                    ( 0.0, 100.0/800, 0.0 ),
                    ( 100.0/600.0, 100.0/800, 0.0 ),
                    ( 100.0/600, 0.0, 0.0 ) ] )
      super( Gitem, self ).__init__(self.texture, _model, _bound )

    self.type = None
    self.name = 'item name'
    self.value = None
    self.volume = 1.0
    self.mass   = 1.0
    self._slot = None
Example #4
0
    def __init__(self, assetpath):
        """
      Initialize the Effect with the art assets located at assetpath

      INPUT:
        assetpath: the full path to the directory containing the images to use
      
      image file names should be sortable in the order they are to be played
    """
        #TODO: hardcoded asset paths
        self._gfxeffects = {
            'null': None,
            'slash': {
                'assetpath': "/home/lorin/projects/ge/art/cut_a",
                'framepaths': []
            }
        }
        framenames = os.listdir(
            assetpath)  #retrieve the names of all files in the dir
        framenames.sort()
        framepaths = []
        for frame in framenames:
            framepaths.append(str(os.path.join(
                assetpath, frame)))  #generate the full path to the asset

        #TODO: BAAAAH, MESSY, model should be somewhere else, like file or db
        _model = Vertel()
        _model.set([(0.0, 0.0, 0.0), (0.0, 100.0 / 600.0, 0.0),
                    (100.0 / 800.0, 100.0 / 600.0, 0.0),
                    (100.0 / 800.0, 0.0, 0.0)])
        super(Effect, self).__init__(framepaths, _model)
        self.alive = True

        #init triggers
        self._triggers = {
        }  #currently 1 callback per frame, multiple triggers doable with multidict
Example #5
0
 def __init__(self):
     """
 """
     self.sel = False
     self._image_file = "/home/lorin/projects/ge/art/planetcute/Selector.png"
     self._pos = Vertex()
     self._pos.append(-1.0)
     self._pos.append(-1.0)
     _model = Vertel()
     _model.set([(0.0, 0.0, 0.0), (0.0, 171.0 / 600.0, 0.0),
                 (101.0 / 800.0, 171.0 / 600.0, 0.0),
                 (101.0 / 800.0, 0.0, 0.0)])
     _bound = Vertel()
     _bound.set([(0.0, 0.0, 0.0), (0.0, 100.0 / 600, 0.0),
                 (100.0 / 800.0, 100.0 / 600, 0.0),
                 (100.0 / 800, 0.0, 0.0)])
     super(Selection, self).__init__(self._image_file, _model,
                                     _bound)  #, offset=(0,50))
Example #6
0
  def __init__(self, x, y, tilecode ):
    """
    """
    self._tilecode = tilecode
    self.tile_size = (100,82) #magic, depends on tile set
    # dict of tile type to image path mappings, will eventually be part of DB
    self.tiletypes = { '#' : "/home/lorin/projects/ge/art/planetcute/Stone Block.png",
                       '.' : "/home/lorin/projects/ge/art/planetcute/Stone Block.png",
                       'e' : "/home/lorin/projects/ge/art/planetcute/Wood Block.png",
                       'x' : "/home/lorin/projects/ge/art/planetcute/Wood Block.png"}

    self._itemoffset = Vertex()
    self._itemoffset.append (0.0)
    self._itemoffset.append (0.0)
    self._itemoffset[1] = 0.054
#    super(Tile,self).__init__( model   = [ (0,0), (0,181), (100,181), (100,0) ],
#                               texture = self.tiletypes[tilecode],
#                               x = 100,
#                               y = 85,
#                               boundoffset = (0,44) )
    _model = Vertel()
    _model.set( [ ( 0.0, 0.0, 0.0 ), 
                  ( 0.0, 171.0/600.0, 0.0 ), 
                  ( 101.0/800.0, 171.0/600.0,0.0 ),
                  ( 101.0/800.0 , 0.0, 0.0 ) ] )
    _bound = Vertel() 
    _bound.set( [ ( 0.0, 0.0, 0.0 ),
                  ( 0.0, 100.0/600.0, 0.0 ),
                  ( 100.0/800.0, 100.0/600, 0.0 ),
                  ( 100.0/800, 0.0, 0.0 ) ] )
    super(Tile,self).__init__( self.tiletypes[tilecode], _model, _bound )


    self.x = x
    self.y = y
    self.items = list()
    self.full = False
Example #7
0
 def __init__(self):
   """
   """
   self.sel = False
   self._image_file = "/home/lorin/projects/ge/art/planetcute/Selector.png"
   self._pos = Vertex()
   self._pos.append( -1.0 )
   self._pos.append( -1.0 )
   _model = Vertel()
   _model.set( [ ( 0.0, 0.0, 0.0 ), 
                 ( 0.0, 171.0/600.0, 0.0 ), 
                 ( 101.0/800.0, 171.0/600.0,0.0 ),
                 ( 101.0/800.0 , 0.0, 0.0 ) ] )
   _bound = Vertel()
   _bound.set( [ ( 0.0, 0.0, 0.0 ),
                 ( 0.0, 100.0/600, 0.0 ),
                 ( 100.0/800.0, 100.0/600, 0.0 ),
                 ( 100.0/800, 0.0, 0.0 ) ] )
   super( Selection, self ).__init__( self._image_file, _model, _bound )#, offset=(0,50))