예제 #1
0
from meet import *
import meet
import math
import random
cells = []
i = 0
for i in range(0, 10):
	cell1 = {"x":meet.get_random_x(), "y":meet.get_random_y(), "radius":meet.random.randint(2,50), "dy":random.random() , "dx":random.random(), "color":"pink"}
	z= create_cell(cell1)
	cells.append(z)
agario1= {"x": meet.get_x_mouse(), "y": meet.get_y_mouse(), "radius": 50, "dy":0, "dx":0}
agario = create_cell(agario1)
agarios=[agario]
def border():
	right = meet.get_screen_width()
	left = -meet.get_screen_width()
	up = meet.get_screen_height()
	down = -meet.get_screen_height()
	for cell in cells:
		if cell.ycor()+cell.get_radius() >= up or cell.ycor()-cell.get_radius() <= down or cell.xcor()+cell.get_radius() >= right or cell.xcor()-cell.get_radius() <= left:
			cell.set_dx(-cell.get_dx())
			cell.set_dy(-cell.get_dy())


                        
while True : 
	meet.move_cells(cells)
	meet.move_cells(agarios)
	dx,dy=meet.get_user_direction(agario)
	agario.set_dx(dx)
	agario.set_dy(dy)
예제 #2
0
from meet import *
import meet

cells=[]
colors=['red','green','yellow','black','pink','orange']
for i in range(0,20):
	cell= {'x':meet.get_random_x(), 'y':meet.get_random_y(), 'radius':random.randint(5,50), 'dx':random.uniform(0.1,2), 'dy':random.uniform(0.1,2),'color':random.choice(colors)}
	a=create_cell(cell)
	cells.append(a)
user_cell={'x': meet.get_x_mouse(),'y': meet.get_y_mouse(),'radius': 20,'dx': 0,'dy': 0,'color':'blue'}
user=create_cell(user_cell)
users=[user]

def borders():
	w1=meet.get_screen_width()
	w2=-meet.get_screen_width()
	h1=meet.get_screen_height()
	h2=-meet.get_screen_height()
	for cell in cells:
		if cell.ycor()+cell.get_radius()>=h1 or cell.ycor()<=h2:
			cell.set_dy(-cell.get_dy())
		if cell.xcor()+cell.get_radius()>=w1 or cell.xcor()<=w2:
			cell.set_dx(-cell.get_dx())


while True:
	meet.move_cells(cells)
	meet.move_cells(users)
	dx,dy=meet.get_user_direction(user)
	user.set_dx(dx)
	user.set_dy(dy)
예제 #3
0
    ydirection= random.randint(2,3)
    speed = 25
    if xdirection== 0:
        _dx= -radius/ speed
    if xdirection==1:
        _dx= radius/ speed
    if ydirection==2:
        _dy= radius/ speed
    if ydirection==3:
        _dy= -radius/ speed

        
    cell1={'x':meet.get_random_x(),'y':meet.get_random_y(),'radius':radius,'dx':_dx,'dy':_dy, 'color':random_color}
    a= create_cell(cell1)
    cells.append(a)
user= {"x":meet.get_x_mouse(), "y":meet.get_y_mouse(),"radius":25, "dx":_dx,"dy":_dy}
user= create_cell(user)
cells.append(user)
def border():
    right= meet.get_screen_width()
    left= -meet.get_screen_width()
    up= meet.get_screen_height()
    down= -meet.get_screen_height()
    for cell in cells:
        if cell.xcor() + cell.get_radius() >= right:
            cell.set_dx(-cell.get_dx())
        if cell.xcor() - cell.get_radius() <= left:
            cell.set_dx(-cell.get_dx())
        if cell.ycor() + cell.get_radius() >= up:
            cell.set_dy(-cell.get_dy())
        if cell.ycor() - cell.get_radius() <= down: