Skip to content

Instantly share code, notes, and snippets.

@alejandroave
Created May 21, 2013 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandroave/5622198 to your computer and use it in GitHub Desktop.
Save alejandroave/5622198 to your computer and use it in GitHub Desktop.
identificar y verificacion
if algo == 1 or bolarray[i].cond == 1: ##si algo == 1 es que encontro el nodo referencia o tiene condicion
pygame.draw.circle(screen, (255, 0, 255), (ax, ay), 10) ##para enviar mensajes
bolarray[i].cond = 1
if bolarray[i].ttl <= 0: ##checa si es un nodo nuevo que acava de detectar nodo de referencia
ttl = ttli
actual = ttl
else:
ttl = bolarray[i].ttl - 1 ##modifica el ttl a pasar en caso de que sea nodo parado
actual = ttl
for j in range(len(bolarray)): ##verificar los vecinos si estan dentro del rango
if j != i :
algo,distancia = proceso(bolarray[i].posx, bolarray[i].posy, bolarray[i].ran, bolarray[j].posx, bolarray[j].posy)
if algo == 1 and bolarray[i].life - distancia > 0: ## si estan dentro del rango y si aun le alcanza
bolarray[j].cond = 1 ##la pila
bolarray[i].life = bolarray[i].life - distancia ##modificamos pila
bolarray[j].ttl = ttl ##guardamos el ttl para este nodo
#texto = fuente.render(""+str(ttl)+"", 0, (255, 255, 255))
#screen.blit(texto, (bolarray[i].posx,bolarray[i].posy))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment