コード例 #1
0
ファイル: game.py プロジェクト: noga17-meet/MEET-YL1
	global playing
	for i in cells:
		for j in cells:
			distance=((i.xcor()-j.xcor())**2 + (i.ycor()-j.ycor())**2)**0.5
			if distance<=i.get_radius() + j.get_radius():
				if i.get_radius()>j.get_radius():
					i.set_radius(i.get_radius() + 2)
					x=meet.get_random_x()
					y=meet.get_random_y()
					j.goto(x,y)
				if i == user_cell1 and i.get_radius()<j.get_radius():
					turtle.write('Game Over',align='center',font=('ariel',50,'bold'))
					time.sleep(3)
					turtle.bye()

meet.move_cells(cells)
turtle.write('3',align='center',font=('ariel',70,'bold'))
time.sleep(1)
turtle.clear()
turtle.write('2',align='center',font=('ariel',70,'bold'))
time.sleep(1)
turtle.clear()
turtle.write('1',align='center',font=('ariel',70,'bold'))
time.sleep(1)
turtle.clear()

 
                                               
while playing:
	meet.move_cells(cells)
	borders(cells)
コード例 #2
0
ファイル: game.py プロジェクト: hamzeh17-meet/MEET-YL1
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)
	borders()
	
	







コード例 #3
0
ファイル: game2.py プロジェクト: reut17-meet/MEET-YL1
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)
	border()

for c in cells:	
	if agario.distance(c) < 20:
		turtle.bye()
コード例 #4
0
ファイル: Agario.py プロジェクト: harel17-meet/MEET-YL1
			distance = ((x1 - x2)**2 + (y1 - y2)**2)**0.5
			r1 = cell.get_radius()
			r2 = cell2.get_radius()
			min_d = r1 + r2
			if distance < min_d:
				if (r1 > r2):
					cell2.goto(meet.get_random_x(),meet.get_random_y())
					r1 = r1 + r2/10
					cell.set_radius(r1)
					if cell2 == user_cell:
						exit = False
						print("game over")
						turtle.write('Game Over' , align='center', font=('ariel',50,'bold'))
					if user_cell.radius > 75:
						exit = False
						print("You Win")
						turtle.write('You Win' , align='center', font=('ariel',50,'bold'))


while exit:
	x,y = meet.get_user_direction(user_cell)
	user_cell.set_dx(x)
	user_cell.set_dy(y)
	meet.move_cells(cells)

	check_x_border(cells)	
	check_y_border(cells)
	
	eat_cells(cells)

meet.mainloop()
コード例 #5
0
ファイル: agar.py プロジェクト: sadekj/meet_turtle_lib
					if(c2 == user_cell):
						running = False
					elif(c1 == user_cell):
						meet.clear()
						meet.goto(-meet.get_screen_width(),meet.get_screen_height()-10);
						meet.write(user_cell.get_radius())
				elif(c1.get_radius()<c2.get_radius()):
					c1.goto(meet.get_random_x(),meet.get_random_y())
					c2.set_radius(c2.get_radius()+c1.get_radius()*0.1)
					if(c1 == user_cell):
						running = False

def move_user_cell(user_cell):
	xdir,ydir = meet.get_user_direction(user_cell)
	user_cell.set_dy(ydir)
	user_cell.set_dx(xdir)

############



while(running):
	check_walls(cells)
	move_user_cell(user_cell)
	meet.move_cells(cells)
	if(food_eaten):
		meet.move_cells(foods)
	check_collision(cells)
	#print ("------------------------")
print ("You Lost")
meet.mainloop()