Exemplo n.º 1
0
  def add_available_animal(self):
    Selena = cat("Selena", "calico cat", 1, 10, "female", "tuna", "loving")
    Wuffles = dog("Wuffles", "yorkshire terrier dog", 2, 12, "male", "beef-flavored dog food", "playful")
    Roddy = fish("Roddy", "goldfish", 1/2, 1, "male", "fish flakes", "docile")
    Chipper = hamster("Chipper", "syrian hamster", 3, 5, "male", "sunflower seeds", "hyper")
    Lisa = turtle("Lisa", "box turtle", 30, 2, "female", "fresh vegetables and bugs", "curious")

    self.available_animals = {
      'cat': Selena,
      'dog': Wuffles,
      'fish': Roddy,
      'hamster': Chipper,
      'turtle':  Lisa
    }
Exemplo n.º 2
0
def inGame():
    global surface, spacePressed, upPressed, time_between_fishes, last_fish, time_between_fishes, fishes, score, state, stageToDraw, winner
    if GAME_TIME.get_ticks() - last_fish > time_between_fishes:
        fishes.append(fish.fish(random_type(),random_dir(),random_pos(WINDOW_HEIGHT),WINDOW_WIDTH,pygame))
        last_fish = GAME_TIME.get_ticks()
        if time_between_fishes > MIN_TIME_BETWEEN_FISHES:
            time_between_fishes *= DIFFICULTY
        
    pressedList = [spacePressed, upPressed]       
    for i, player in enumerate(players):
        if pressedList[i]:
            moveList[i] = 'up'
        else:
            moveList[i] = 'down'
        player.draw(surface, GAME_TIME.get_ticks())
        player.move(moveList[i])
    for i, enemy in enumerate(fishes):
        enemy.draw(surface, GAME_TIME.get_ticks())
        enemy.move()
        for k, player in enumerate(players):
            if enemy.eat(player.returnSquares()):
                player.changeToDead()
                enemy.changeToEating()
                if gameMode == 2 : # mode two enemies, winner can be used in the next state
                    if winner == 0 :
                        if k == 0 : 
                            winner = 2
                        else:
                            winner = 1
        if enemy.isDead(WINDOW_WIDTH):
            if enemy.isEating():
                if gameMode == 2 :
                    state = 'twoEnemiesScreen'
                else: 
                    if indexScore() == 5:
                        state = 'hallOfFameScreen'
                    else:
                        state = 'enterName'
            else:
                score += 1
            fishes.remove(enemy)          
    draw_score()
Exemplo n.º 3
0
import fish
import random

fish.fish()

x = random.randrange(1, 1000)
print(x)
Exemplo n.º 4
0
from fish import fish

pygame.init()
screen_info = pygame.display.Info()
x = screen_info.current_w
y = screen_info.current_h

screen = pygame.display.set_mode((x, y))
clock = pygame.time.Clock()
Color = (0, 1, 225)

image = pygame.image.load('picture.png')
rect = image.get_rect()
rect.center = (x // 2, y // 2)

Bob = fish()
Bob.rect = image.get_rect()
Bob.rect.center = (x // 2, y // 2)
alex = fish()
alex.rect.center = (20, 10)
gus = fish()
gus.rect.center = (300, 200)
gus.speed = pygame.math.Vector2(2, 0)

#Bob.image=pygame.image.load("picture.png")
#gus.image=pygame.image.load('picture.png')
#alex.image=pygame.image.load('picture.png')
Bob.speed = pygame.math.Vector2(0, 1)


def update():
Exemplo n.º 5
0
def fish_():
    return fish()
Exemplo n.º 6
0
         spacePressed = False
         stageToDraw = imagesBackground
         state = 'menuScreen'
 elif state == 'menuScreen':
     menuScreen()
     if spacePressed:
         newGame()
         if gameMode == 0: #only me
             players.append(worm.worm('player1', POS_ONLYME, pygame))
         else:
             players.append(worm.worm('player1', POS_P1, pygame))
             players.append(worm.worm('player2', POS_P2, pygame))
         spacePressed = False
         time_between_fishes = TIME_BETWEEN_FISHES_O # Init of time between fishes. It will be decreased progresivelly
         last_fish = GAME_TIME.get_ticks()
         fishes.append(fish.fish('big',random_dir(),random_pos(WINDOW_HEIGHT),WINDOW_WIDTH,pygame))
         state = 'inGame'
 elif state == 'inGame':
     inGame()
 elif state == 'twoEnemiesScreen':
     twoEnemiesScreen()
     if spacePressed:
         spacePressed = False
         stageToDraw = imagesTitle
         state = 'welcomeScreen'
 elif state == 'hallOfFameScreen':
     hallOfFameScreen()
     if spacePressed:
         spacePressed = False
         stageToDraw = imagesTitle
         state = 'welcomeScreen'