def __init__(self, boat):
     Sprite.__init__(self, 32, 32, 0, 0)
     self.setImage(pygame.image.load("res/line.png").convert())
     self.setHeight(77)
     self.image = pygame.transform.scale(self.image, (5, self.height))
     self.boat = boat
     pass
Exemple #2
0
    def __init__(self, image):
        Sprite.__init__(self, image, 0, 0, randint(1,5))
        self.Index = randint(0,1)
        self.XPosition = randint(0, 768)
        self.YPosition = randint(0, 15) * 32
        self.LastFired = randint(0,50)
        self.Score = self.Speed
        if(randint(0,1) == 1):
            self.Left = False
        else:
            self.Left = True

        self.Right = not self.Left
        
        if(Sprite.MonsterFrames == []):
            Sprite.MonsterFrames.append(pygame.Surface((32,32)).convert_alpha())
            Sprite.MonsterFrames.append(pygame.Surface((32,32)).convert_alpha())
            Sprite.MonsterFrames.append(pygame.Surface((32,32)).convert_alpha())
            Sprite.MonsterFrames.append(pygame.Surface((32,32)).convert_alpha())
            Sprite.MonsterFrames[0].fill((0,0,0,0))
            Sprite.MonsterFrames[1].fill((0,0,0,0))
            Sprite.MonsterFrames[2].fill((0,0,0,0))
            Sprite.MonsterFrames[3].fill((0,0,0,0))
            Sprite.MonsterFrames[0].blit(image,(0,0),(32,0,32,32))
            Sprite.MonsterFrames[1].blit(image,(0,0),(32,32,32,32))
            Sprite.MonsterFrames[2].blit(image,(0,0),(64,0,32,32))
            Sprite.MonsterFrames[3].blit(image,(0,0),(64,32,32,32))
    def __init__(self, word, speed):
        Sprite.__init__(self, 32, 32, 0, 0)
        #self.image1=pygame.image.load("Fish/Fish1.png")
        self.image2 = pygame.image.load("Fish/Fish2.png")
        #self.image3=pygame.image.load("Fish/Fish3.png")

        self.hooked = False
        self.word = word
        font = pygame.font.SysFont('Courier New', 15)
        text = font.render(self.word.toString(), True, (255, 255, 0))
        textpos = text.get_rect()

        textwidth = tuple(textpos)[2] + 15
        self.image2.set_colorkey((0, 0, 0))
        self.setImage(pygame.transform.scale((self.image2), (textwidth, 32)))
        self.setWidth(textwidth)
        self.setHeight(25)

        self.textwidth = tuple(textpos)[2]
        self.image2.set_colorkey((0, 0, 0))
        # self.image = self.all_images[self.frame]

        #self = pygame.transform.scale(self, (1200,800))
        self.fishSpeed = speed

        self.last_update = 0
        self.frame = 0

        pass
Exemple #4
0
 def __init__(self, filename):
     self._movie = pygame.movie.Movie(filename)
     surf = pygame.surface.Surface(self._movie.get_size())
     self._movie.set_display(surf)
     self._lastFrame = None
     self._movie.set_volume(0.0)
     Sprite.__init__(self, surf)
Exemple #5
0
 def __init__( self, x, y, width, height, fname ):
     Sprite.__init__( self, x, y, width, height )
     bitmap = pygame.image.load( fname ).convert_alpha()
     self.images[ self.UP ] = (
             bitmap.subsurface( ( width * 0, height * 0, width, height ) ),
             bitmap.subsurface( ( width * 0, height * 1, width, height ) ),
             bitmap.subsurface( ( width * 0, height * 2, width, height ) ),
             bitmap.subsurface( ( width * 0, height * 3, width, height ) )
         )
     self.images[ self.DOWN ] = (
             bitmap.subsurface( ( width * 1, height * 0, width, height ) ),
             bitmap.subsurface( ( width * 1, height * 1, width, height ) ),
             bitmap.subsurface( ( width * 1, height * 2, width, height ) ),
             bitmap.subsurface( ( width * 1, height * 3, width, height ) )
         )
     self.images[ self.LEFT ] = (
             bitmap.subsurface( ( width * 2, height * 0, width, height ) ),
             bitmap.subsurface( ( width * 2, height * 1, width, height ) ),
             bitmap.subsurface( ( width * 2, height * 2, width, height ) ),
             bitmap.subsurface( ( width * 2, height * 3, width, height ) )
         )
     self.images[ self.RIGHT ] = (
             bitmap.subsurface( ( width * 3, height * 0, width, height ) ),
             bitmap.subsurface( ( width * 3, height * 1, width, height ) ),
             bitmap.subsurface( ( width * 3, height * 2, width, height ) ),
             bitmap.subsurface( ( width * 3, height * 3, width, height ) )
         )
     self.setHeading( self.LEFT )
     self.setSteps( 2, 2 )
     self.setUpdateInterval( 16 )
     self.setRefreshInterval( 16 )
	def __init__(self, angle, playerDist, speed=100):
		Sprite.__init__(self, 0, 0, "assets/game/bullet")
		self.distance = playerDist + self.image.get_width()
		self.angle = angle
		self.speed = speed
		self.position = Vector.FromAngle(self.angle, self.distance)
		self.position.x += (App.Width / 2) - (self.image.get_width() / 2)
		self.position.y += (App.Height / 2) - (self.image.get_height() / 2)
Exemple #7
0
 def __init__(self, x_pos, y_pos, filename, alt_filename, speed):
     '''
     Constructor
     '''
     Sprite.__init__(self, x_pos, y_pos, filename, alt_filename)
     self.speed = speed
     self.width = self.bitmap.get_width()
     self.height = self.bitmap.get_height()
Exemple #8
0
 def __init__( self ):
     
     Sprite.__init__( self , 32 , 32 , 0 , 0 )
     boatImage = pygame.image.load( "res/boat.png" ).convert()
     boatImage.set_colorkey( (255, 255, 255) )
     boatImage = pygame.transform.scale( boatImage , ( 180 , 140 ) )
     self.setImage( boatImage );
     pass
 def __init__(self, x, y, w, h, model):
     Sprite.__init__(self, x, y, w, h,
                     model)  #Calls super constructor in sprite class
     #Initializes Member Variables
     self.jumpFrame = 0  #Checks to see how many frames Mario has jumped
     self.prevX = 0
     self.prevY = 0
     self.coinPop = 0  #Makes sure only one coin pops out
     marioImages = None
Exemple #10
0
 def __init__(self, image_rect):
     """
     Calls Spite.init as super
     Sets speed and radius
     Adds to global bee_group
     """
     Sprite.__init__(self, pygame.image.load("Resources/sprites/bees.png"), image_rect, "bees")
     self.speed = 15
     self.radius = 250
     Global.bee_group.add_internal(self)
Exemple #11
0
 def __init__( self , boat, line):
     Sprite.__init__( self , 32 , 32 , 0 , 0 )
     hookImage = pygame.image.load( "res/hook.png" );
     hookImage = pygame.transform.scale( hookImage , ( 50 , 50 ) );
     self.setImage( hookImage );
     self.boat = boat
     self.line = line
     self.setHeight( 35 )
     self.setWidth( 30 )
     pass
	def __init__(self,sprites,locationX,locationY):
		Sprite.__init__(self,sprites,locationX,locationY)
		#self.vx = 0
		#self.vy = 0
		#self.pvx = 0 #previous velocity, stored to help out its snake followers
		#self.pvy = 0
		self.movingto = None
		self.backlog = None #If recieves a move command while still moving, goes here
		self.follower = None #a Movable is a Snake.  This links to its follower
		self.smoothtransitioncounter = 0#from 0-1 representing sprite inbetween thingies
Exemple #13
0
 def __init__(self, image_rect):
     """
     Calls Spite.init as super
     Sets speed, radius and runningAway (a boolean)
     Adds to global deer_group
     """
     Sprite.__init__(self, pygame.image.load("Resources/sprites/wolf.png"), image_rect, "wolf")
     self.speed = 15
     self.radius = 100
     self.stealth = 60
     Global.wolf_group.add_internal(self)
	def __init__(self):
		Sprite.__init__(self, 0, 0, "assets/game/player")
		self.angle = 0
		self.distance = 100
		self.velocity = 0
		self.accel = 17.0
		self.maxVelocity = 450.0
		self.bullets = pygame.sprite.Group()
		self.shootTimer = 0
		self.shootRate = 0.35
		self.shootSound = pygame.mixer.Sound("assets/game/shoot.wav")
Exemple #15
0
 def __init__(self, rect, is_pollinated=False):
     """
     Calls Spite.init as super
     Sets speed, radius and is_pollinated (a boolean)
     Adds to global plant_group
     Loads pollinated image if is_pollinated
     """
     Sprite.__init__(self, pygame.image.load("Resources/sprites/plant.png"), rect, "plant")
     self.screen = Utils.screen
     self.is_pollinated = is_pollinated
     Global.plant_group.add_internal(self)
     if self.is_pollinated:
         self.image = pygame.image.load("Resources/sprites/plantpollinated.png")
Exemple #16
0
    def __init__(self, location, velocity, direction):
        """ Bullet class for the Asteroids game

        Parameters
        ----------
        location : list of ints
            x, y pixel position of the center of the bullet
        velocity : int
            velocity of the bullet (always 30)
        direction : int
            0-19 direction of travel of the bullet
        """
        Sprite.__init__(self, location, velocity, direction)
        self.lifetime = 20
Exemple #17
0
    def __init__(self, image):
        Sprite.__init__(self, image, 300, 568, 3)

        if(Sprite.PlayerFrames == []):
            Sprite.PlayerFrames.append(pygame.Surface((32,32)).convert_alpha())
            Sprite.PlayerFrames.append(pygame.Surface((32,32)).convert_alpha())
            Sprite.PlayerFrames.append(pygame.Surface((32,32)).convert_alpha())
            Sprite.PlayerFrames[0].fill((0,0,0,0))
            Sprite.PlayerFrames[1].fill((0,0,0,0))
            Sprite.PlayerFrames[2].fill((0,0,0,0))
            Sprite.PlayerFrames[0].blit(image,(0,0),(0,0,32,32))
            Sprite.PlayerFrames[1].blit(image,(0,0),(0,32,32,32))
            Sprite.PlayerFrames[2].blit(image,(0,0),(0,64,32,32))
        if(Player.SEffect == None):
            Player.SEffect = pygame.mixer.Sound("Fireball1.wav")
Exemple #18
0
    def __init__(self, stats, fishingHook, fishingLine, eelSpeed):
        Sprite.__init__(self, 32, 32, 0, 0)
        eelImage = pygame.image.load("res/eel.png").convert_alpha()
        #eelImage = pygame.image.load( "res/eel1.png" ).convert()
        #eelImage = pygame.transform.scale( eelImage , (100 , 50) )
        #eelImage.set_colorkey( (255,255,255) )
        self.setImage(eelImage)
        self.stats = stats

        self.fishingHook = fishingHook
        self.fishingLine = fishingLine

        #slightly offset eel picture's extra whitespace width
        self.setWidth(48)
        #self.setHeight( 15 )
        self.speed = eelSpeed
Exemple #19
0
    def __init__(self, location, velocity, direction):
        """ Ship class for Asteroids game

        Parameters
        ----------
        location : list of ints
            x, y pixel position of the center of the ship
        velocity : int
            velocity of the ship
        direction : int
            0-19 direction of travel of the ship
        """
        Sprite.__init__(self, location, velocity, direction)
        self.rotation_map = self.rotation_map_constructor()
        self.rotation = 0
        self.update_point_list()
        self.thruster = 0
Exemple #20
0
    def __init__(self, location, velocity, direction, size, color):
        """ Asteroid class for Asteroids game

        Parameters
        ----------
        location : list of ints
            x, y pixel position of center of the asteroid
        velocity : int
            velocity of the asteroid (possible values 3, 6, 12)
        direction : int
            0-19 direction of travel of the asteroid
        size : int
            size of the asteroid (possible values 60, 30, 15)
        color : tuple of ints
            RGB values for asteroid color
        """
        Sprite.__init__(self, location, velocity, direction)
        self.size = size
        self.color = color
Exemple #21
0
 def __init__(self, image, xPos, yPos, index):
     pygame.sprite.Sprite.__init__(self)
     Sprite.__init__(self, image, 0, 0, 0)
     self.image = pygame.Surface((32, 32))
     self.Index = index
     self.XPosition = xPos
     self.YPosition = yPos
     self.Left = False
     self.Right = False
     if (Sprite.FBFrames == []):
         Sprite.FBFrames.append(pygame.Surface((32, 32)).convert_alpha())
         Sprite.FBFrames.append(pygame.Surface((32, 32)).convert_alpha())
         Sprite.FBFrames.append(pygame.Surface((32, 32)).convert_alpha())
         Sprite.FBFrames.append(pygame.Surface((32, 32)).convert_alpha())
         Sprite.FBFrames[0].fill((0, 0, 0, 0))
         Sprite.FBFrames[1].fill((0, 0, 0, 0))
         Sprite.FBFrames[2].fill((0, 0, 0, 0))
         Sprite.FBFrames[3].fill((0, 0, 0, 0))
         Sprite.FBFrames[0].blit(image, (0, 0), (96, 0, 32, 32))
         Sprite.FBFrames[1].blit(image, (0, 0), (96, 32, 32, 32))
         Sprite.FBFrames[2].blit(image, (0, 0), (128, 0, 32, 32))
         Sprite.FBFrames[3].blit(image, (0, 0), (128, 32, 32, 32))
Exemple #22
0
 def __init__(self, x, y, vector, team):
     Sprite.__init__(self, x, y, team)
     self.vector = vector
     self.ampx = self.x + (self.amplitude *
                           cos(TWO_PI * frameCount / self.period))
Exemple #23
0
	def __init__(self, font, text, color):
		surf = font.render(text, 1, color)
		Sprite.__init__(self, surf)
 def __init__(self, x, y, team):
     Sprite.__init__(self, x, y, team)
     self.armory.add(Simpleton(self))
     self.primaryWeapon = self.armory.equip("Simpleton")
Exemple #25
0
 def __init__(self, x, y, team):
     Sprite.__init__(self, x, y, team)
Exemple #26
0
 def __init__(self, x, y, vector, team):
     Sprite.__init__(self, x, y, team)
     self.vector = vector
Exemple #27
0
 def __init__(self, x, y, w, h, model):
     Sprite.__init__(self, x, y, w, h, model)
     self.moveCoinX = random.randint(1, 10)
     self.vert_vel = -20.0
 def __init__(self, sprites, locationX, locationY, passable, damage):
     Sprite.__init__(self, sprites, locationX, locationY)
     self.passable = passable
     self.damage = damage
     self.pickup = None
     self.moveable = None
Exemple #29
0
	def __init__(self):
		Sprite.__init__(self, 0, 0, "assets/game/ball")
		self.source = self.image.copy()
	def __init__(self, x, y, path=""):
		Sprite.__init__(self, x, y, path, 3)
		self.state = NONE
		self.down = False
		self.justPressed = False
Exemple #31
0
 def __init__(self, pos=(1, 1)):
     self.frames = SPRITE_CACHE["player.png"]
     Sprite.__init__(self, pos)
     self.direction = 2
     self.animation = None
     self.image = self.frames[self.direction][0]
 def __init__(self, sprites, locationX, locationY, on_collision):
     Sprite.__init__(self, sprites, locationX, locationY)
     self.on_collision = on_collision
Exemple #33
0
 def __init__(self, x, y, w, h, model):
     Sprite.__init__(self, x, y, w, h, model)
Exemple #34
0
 def __init__(self, x, y, team):
     Sprite.__init__(self, x, y, team)
     self.primaryWeapon = PeaShooter(self)
 def __init__(self, x, y, velocity, team):
     Sprite.__init__(self, x, y, team)
     self.velocity = velocity