Simple A* algorithm example made in UPBGE/Blender and python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

point_anim.py 959B

12345678910111213141516171819202122232425262728293031323334
  1. import bge
  2. def main(cont):
  3. own = cont.owner
  4. if 'inited' not in own:
  5. own['inited'] = True
  6. own['direction'] = False
  7. own['speed'] = .5
  8. own['life'] = 0
  9. own['ticker'] = 2.0
  10. multer = 1
  11. inc = .05
  12. color = own.color
  13. if own['life'] > (own['id'] * multer):
  14. if color[3] < 1:
  15. own.color[3] += inc
  16. if 'star' in own and own['life'] > ((own['id'] * multer) + 60) and (own['life'] % 2) == 0:
  17. if own['direction'] == True:
  18. own['ticker'] = own['ticker'] + own['speed']
  19. if own['direction'] == False:
  20. own['ticker'] = own['ticker'] - own['speed']
  21. if own['ticker'] > 16:
  22. own['direction'] = False
  23. if own['ticker'] < .01:
  24. own['direction'] = True
  25. print(own['ticker'])
  26. own.color = [color[0], color[1], color[2], own['ticker']]
  27. own['life'] += 1