예제 #1
0
def eat_cells(cell):
	for b in range(NUM_CELLS):
		other_cell = cells[b]
		if cell != other_cell and cells_collide(cell, other_cell):
			radius = palgame.get_radius(cell)
			if radius >= palgame.get_radius(other_cell):
				new_radius = radius + (1 - radius / 100)
				palgame.set_radius(cell, new_radius)
				cells[b] = palgame.get_random_ball()
예제 #2
0
RED = (255, 0, 0)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)

palgame.build_screen(SCREEN_WIDTH, SCREEN_HEIGHT)

x = SCREEN_WIDTH / 2
y = SCREEN_HEIGHT / 2

xdir = 1
ydir = 1
cells = []
food = []

for a in range(NUM_CELLS):
    cells.append(palgame.get_random_ball())

for c in range(NUM_FOOD):
    food.append(palgame.get_random_food())

first_cell = palgame.get_random_ball()
user_cell = palgame.get_random_user()


# This function updates the position of any cell.
def update_cell_position(cell, speed):
    pass


# This function updates the position of only the user cell.
def update_user_cell_position(cell):
예제 #3
0
RED = (255, 0, 0)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)

palgame.build_screen(SCREEN_WIDTH, SCREEN_HEIGHT)

x = SCREEN_WIDTH / 2
y = SCREEN_HEIGHT / 2

xdir = 1
ydir = 1
cells = []
food = []

for a in range(NUM_CELLS):
	cells.append(palgame.get_random_ball())

for c in range(NUM_FOOD):
	food.append(palgame.get_random_food())

first_cell = palgame.get_random_ball()
user_cell = palgame.get_random_user()

# This function updates the position of any cell.
def update_cell_position(cell, speed):
	pass

# This function updates the position of only the user cell.
def update_user_cell_position(cell):
	pass