Exemple #1
0
	def __init__(self,x,y):
		cMonster.cMonster.__init__(self,x,y)
		self.image      = pygame.image.load("sprites/flie_col.png").convert_alpha()
		self.rect	= self.image.get_rect().move(x,y)
		self.mask       = pygame.mask.from_surface(self.image);
		
		anim_images     = BF.load_and_slice_sprite(32,32,'flie_anim.png');
		col_anim_images = BF.load_and_slice_sprite(32,32,'flie_anim_death.png');
                
		self.anim     	= cAnimSprite(anim_images,30)
		self.col_anim  	= cAnimSprite(col_anim_images,10)
		self.anim.rect  = self.rect
		self.col_anim.rect  = self.rect

		#Status sets
		self.col_anim.draw = False
		self.delete_on_colision = True

		#
		mx=0
		my=0
		while mx==0 and my==0:
			mx = random.randint(-1,1)
			my = random.randint(-1,1)
		
		self.movx = mx
		self.movy = my
Exemple #2
0
	def __init__(self,x,y,rot):
		cMonster.cMonster.__init__(self,x,y,rot)
		self.image      = pygame.image.load("sprites/bouncer.png").convert_alpha()
		self.rect	= self.image.get_rect().move(x,y)
		self.mask       = pygame.mask.from_surface(self.image);
		
		anim_images     = BF.load_and_slice_sprite(32,32,'bouncer_nanim.png');
		col_anim_images = BF.load_and_slice_sprite(32,32,'bouncer_anim.png');
                
		self.anim     	= cAnimSprite(anim_images,5)
		self.col_anim  	= cAnimSprite(col_anim_images,20)
		self.anim.rect  = self.rect
		self.col_anim.rect  = self.rect

		#Status sets
		self.col_anim.draw = False
	def create_sprite(self,x=-5000,y=-5000,spritetype=0):
		"""
			Get a random imageset for a spritetype
			create a Animation Sprite and return it
		"""
		rand = random.randint(0,len(self.all_sprites[spritetype])-1)
		tsprite = cAnimSprite(self.all_sprites[spritetype][rand],self.sprite_fps[spritetype])
		tsprite.move(x,y) #out of view
		tsprite.draw = True
		return tsprite
	def __init__(self,x,y):
		cMonster.cMonster.__init__(self,x,y,0)
        #Get the base circle because i
		self.image      = pygame.image.load("sprites/circle_col.png").convert_alpha()
		self.baseImage  = pygame.image.load("sprites/circle_col.png").convert_alpha()
		self.rect	    = self.image.get_rect().move(x,y)
		self.mask       = pygame.mask.from_surface(self.image);
		
		anim_images     = BF.load_and_slice_sprite(32,32,'recover_lives_anim.png');
		col_anim_images = BF.load_and_slice_sprite(32,32,'recover_lives_anim.png');
                
		self.anim     	= cAnimSprite(anim_images,10)
		self.col_anim  	= cAnimSprite(col_anim_images,20)
		self.anim.rect  = self.rect
		self.col_anim.rect  = self.rect

		#Status sets
		self.col_anim.draw = False
		#Only Usable once
    		self.delete_on_colision = True
Exemple #5
0
	def __init__(self,file):
		parser = SafeConfigParser()
		parser.read(file)

		self.name 	= parser.get('options','name')
		self.startx = int(parser.get('options','startx'))
		self.starty = int(parser.get('options','starty'))
		self.imgcol	= pygame.image.load(parser.get('options','collision')).convert_alpha();
		self.image 	= pygame.image.load(parser.get('options','background')).convert_alpha();
		self.bg 	= pygame.image.load(parser.get('options','background2')).convert_alpha();
		self.mask   = pygame.mask.from_surface(self.imgcol);
		self.rect	= self.image.get_rect();
		self.stick  = parser.get('options','stick')
		self.uuid	= parser.get('options','uuid')

		#Load the Goal sprite
		gx = int(parser.get('options','endx'))
		gy = int(parser.get('options','endy'))
		goal_images     =  BF.load_and_slice_sprite(100,100,'goal.png');
		self.goal_sprite=  cAnimSprite(goal_images,5)
		self.goal_sprite.move(gx + 50,gy + 50) #need the +50 not sure why [TODO]

		#ITEMS LOADING
		bouncers	=  self.retrieve_bouncer_list(file)
		recovers	=  self.retrieve_recover_list(file)
		self.items	=  []
		self.items += bouncers
		self.items += recovers


		#MONSTERS LOADING
		bashers = self.retrieve_basher_list(file)
		#flies = self.retrieve_flies_list(parser)
		flies = []
		self.monsters = []
		self.monsters += bashers
		self.monsters += flies

		#
		# Record Storage between status
		# Read the records once and temprary store them here
		# By default empty, only load records when finishing level
		#
		self.records = []
		self.player_record_index = -1


		#Specific status settings
		try:
			self.start_lives = parser.get('options','start_lives')
		except:
			self.start_lives = 3 #cannot include cStatus
			pass
	def __init__(self,x,y,ex,ey,speed):
		cMonster.cMonster.__init__(self,x,y)
		self.image      = pygame.image.load("sprites/basher_col.png").convert_alpha()
		self.baseImage  = pygame.image.load("sprites/basher_col.png").convert_alpha()
		self.rect		= self.image.get_rect().move(x,y)
		self.mask       = pygame.mask.from_surface(self.image);
		
		anim_images     = BF.load_and_slice_sprite(64,64,'basher_nanim.png');
		col_anim_images = BF.load_and_slice_sprite(64,64,'basher_colanim.png');
                
		self.anim     	= cAnimSprite(anim_images,5)
		self.col_anim  	= cAnimSprite(col_anim_images,5)
		self.anim.rect  = self.rect
		self.col_anim.rect  = self.rect

		#Status sets
		self.col_anim.draw = False

		#
		self.movx = 1
		self.movy = 1
		self.startx = x
		self.starty = y
		self.endx = ex
		self.endy = ey
		self.going_to_end = True
		self.endxbigger = (self.endx > self.startx)
		self.endybigger = (self.endy > self.starty)
		self.speed = speed

		self.toendx , self.toendy = self.to_end_movement()

		#
		# Testing movement with interpolation
		#
		self.mov_points = []
		self.curr_point = 0
		self.interpolate_points_in_line(self.startx,self.starty,self.endx,self.endy)
Exemple #7
0
FONT = pygame.font.Font("ttf/Tusj.ttf", 25)
TIMERFONT = pygame.font.Font("ttf/NATWR.ttf", 55)

#######################################
#
# BASIC SPRITE LOADING
#
#######################################
#sprite factory
SPRITE_FAC = cAnimSpriteFactory.cAnimSpriteFactory()



#Goal Text
imgset = BF.load_and_slice_sprite(300,150,'goal_text.png');
gtext_sprite = cAnimSprite(imgset)
gtext_sprite.move(800,250)

#timer bg
imgset = BF.load_and_slice_sprite(250,123,'timer_bg.png');
bg_timer_image = imgset[0]

#New Record Text
imgset = BF.load_and_slice_sprite(230,100,'newrecord.png');
newrecord_sprite = cAnimSprite(imgset,1)
newrecord_sprite.move(450,150)

#Lives sprite
imgsetlives = BF.load_and_slice_sprite(192,64,'livemeter.png');